pub struct RetryPolicy {
pub max_retries: u32,
pub initial_delay: Duration,
pub backoff_factor: f64,
pub max_retry_after: Duration,
pub jitter: Jitter,
}Expand description
How failed provider calls are retried.
Fields§
§max_retries: u32Maximum number of retries after the first attempt (default 2).
initial_delay: DurationDelay before the first retry (default 2 s).
backoff_factor: f64Multiplier applied to the delay after each retry (default 2.0).
max_retry_after: DurationLargest Retry-After value that is honoured (default 60 s).
jitter: JitterRandom jitter applied to the computed delay (default none).
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn with_max_retries(max_retries: u32) -> Self
pub fn with_max_retries(max_retries: u32) -> Self
Creates the default policy with a different retry count.
Sourcepub fn delay_for(&self, retry: u32, error: &ProviderError) -> Duration
pub fn delay_for(&self, retry: u32, error: &ProviderError) -> Duration
Computes the delay before retry number retry (1-based), honouring
Retry-After headers when they fall within max_retry_after.
Arithmetic overflow saturates at Duration::MAX. Provider calls
reject negative or non-finite backoff factors before using this policy.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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