diff options
author | Arun Raghavan <arun@asymptotic.io> | 2022-03-16 15:06:49 +0300 |
---|---|---|
committer | Arun Raghavan <arun@asymptotic.io> | 2022-03-21 11:20:07 +0300 |
commit | 930f51edbc50da8ca6fde685de2446df3933313d (patch) | |
tree | cc3521aec0e8df961c243452f28875089a800e79 /net | |
parent | cab33768e286835b84abace3c13127feabd4df82 (diff) |
rusoto: s3sink, s3src: Retry on server errors
We can retry in the case of 500/503/other errors that might occur that
might be recoverable, instead of bailing.
Diffstat (limited to 'net')
-rw-r--r-- | net/rusoto/src/s3utils.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/net/rusoto/src/s3utils.rs b/net/rusoto/src/s3utils.rs index 2b344dc3..b973dbea 100644 --- a/net/rusoto/src/s3utils.rs +++ b/net/rusoto/src/s3utils.rs @@ -9,7 +9,7 @@ use bytes::{buf::BufMut, Bytes, BytesMut}; use futures::{future, Future, FutureExt, TryFutureExt, TryStreamExt}; use once_cell::sync::Lazy; -use rusoto_core::RusotoError::HttpDispatch; +use rusoto_core::RusotoError::{HttpDispatch, Unknown}; use rusoto_core::{ByteStream, HttpDispatchError, RusotoError}; use std::sync::Mutex; use std::time::Duration; @@ -80,6 +80,20 @@ where gst_warning!(CAT, "Error waiting for operation ({:?}), retrying", err); backoff::Error::transient(err) } + Unknown(ref response) => { + gst_warning!( + CAT, + "Unknown error waiting for operation ({:?}), retrying", + response + ); + + // Retry on 5xx errors + if response.status.is_server_error() { + backoff::Error::transient(err) + } else { + backoff::Error::permanent(err) + } + } _ => backoff::Error::permanent(err), }) }, |