#[non_exhaustive]pub struct RetryConfig {
pub max_attempts: u32,
pub base_delay: Duration,
pub max_delay: Duration,
pub jitter: bool,
}Expand description
Backoff settings for RetryingModel.
max_attempts counts the total number of calls to the inner model,
including the first one. max_attempts: 3 means up to two retries
after the original failure.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_attempts: u32Total number of calls to the inner model, including the
first one. 1 disables retries; 3 allows two retries
after the initial failure.
base_delay: DurationFirst retry delay. Doubles on each subsequent attempt
(base_delay, 2 * base_delay, 4 * base_delay, …) up to
Self::max_delay.
max_delay: DurationHard cap on the per-retry delay. The exponential schedule stops growing once it hits this value.
jitter: boolWhen true, add 0–10% randomness to each delay so concurrent
clients don’t synchronize their retries. A server-supplied
Retry-After is treated as a floor — jitter only adds time.
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§fn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
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 RetryConfig
impl Debug for RetryConfig
Auto Trait Implementations§
impl Freeze for RetryConfig
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnsafeUnpin for RetryConfig
impl UnwindSafe for RetryConfig
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