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.
This commit is contained in:
Arun Raghavan 2022-03-16 17:36:49 +05:30 committed by Arun Raghavan
parent a3db85d869
commit e973d41bac

View file

@ -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;
@ -78,6 +78,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),
})
},