pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub multiplier: f64,
pub jitter: f64,
pub retry_statuses: Vec<u16>,
pub honor_retry_after: bool,
pub max_retry_after: Duration,
pub defer_over_cap: bool,
}Expand description
Retry/backoff policy. max_attempts counts total tries (1 = no retry).
Fields§
§max_attempts: u32§initial_backoff: Duration§max_backoff: Duration§multiplier: f64§jitter: f64Fraction (0.0..=1.0) of each delay randomly shaved off; 0 = deterministic.
retry_statuses: Vec<u16>§honor_retry_after: bool§max_retry_after: DurationUpper bound applied to a server-supplied Retry-After.
defer_over_cap: boolWhen a server-supplied Retry-After is longer than max_retry_after, stop retrying
instead of sleeping the capped time and asking again too early. The call then returns
the response (or HttpError::Status with the full, uncapped retry_after) so the
caller can schedule the next try durably, for example with QuotaSchedule.
Default false (the old behaviour: sleep the capped delay and retry).
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn defers(&self, retry_after: Option<Duration>) -> bool
pub fn defers(&self, retry_after: Option<Duration>) -> bool
True when retry_after is honoured, defer_over_cap is set and the server asked
for longer than max_retry_after: the retry loop should return, not sleep.
pub fn none() -> Self
pub fn is_retryable_status(&self, status: u16) -> bool
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more