mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-23 17:38:20 +00:00
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:
parent
cab33768e2
commit
930f51edbc
1 changed files with 15 additions and 1 deletions
|
@ -9,7 +9,7 @@
|
||||||
use bytes::{buf::BufMut, Bytes, BytesMut};
|
use bytes::{buf::BufMut, Bytes, BytesMut};
|
||||||
use futures::{future, Future, FutureExt, TryFutureExt, TryStreamExt};
|
use futures::{future, Future, FutureExt, TryFutureExt, TryStreamExt};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use rusoto_core::RusotoError::HttpDispatch;
|
use rusoto_core::RusotoError::{HttpDispatch, Unknown};
|
||||||
use rusoto_core::{ByteStream, HttpDispatchError, RusotoError};
|
use rusoto_core::{ByteStream, HttpDispatchError, RusotoError};
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -80,6 +80,20 @@ where
|
||||||
gst_warning!(CAT, "Error waiting for operation ({:?}), retrying", err);
|
gst_warning!(CAT, "Error waiting for operation ({:?}), retrying", err);
|
||||||
backoff::Error::transient(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),
|
_ => backoff::Error::permanent(err),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue