pub struct JitteredRetryPolicy<T: RetryPolicy> { /* private fields */ }Expand description
Decorates the given RetryPolicy and adds jitter (random delay) to it. This can make retries
more spread out and less likely to all fail at once.
Trait Implementations§
Source§impl<T: RetryPolicy> RetryPolicy for JitteredRetryPolicy<T>
impl<T: RetryPolicy> RetryPolicy for JitteredRetryPolicy<T>
Source§type E = <T as RetryPolicy>::E
type E = <T as RetryPolicy>::E
The error type returned by the
operation in retry.Source§fn next_delay(&self, context: &RetryContext<'_, Self::E>) -> Option<Duration>
fn next_delay(&self, context: &RetryContext<'_, Self::E>) -> Option<Duration>
Returns the duration to wait before trying the next attempt.
context represents the context of a retry operation. Read moreSource§fn with_max_attempts(self, max_attempts: u32) -> MaxAttemptsRetryPolicy<Self>
fn with_max_attempts(self, max_attempts: u32) -> MaxAttemptsRetryPolicy<Self>
Returns a new
RetryPolicy that respects the given maximum attempts.Source§fn with_max_total_delay(
self,
max_total_delay: Duration,
) -> MaxTotalDelayRetryPolicy<Self>
fn with_max_total_delay( self, max_total_delay: Duration, ) -> MaxTotalDelayRetryPolicy<Self>
Returns a new
RetryPolicy that respects the given total delay.Source§fn with_max_jitter(self, max_jitter: Duration) -> JitteredRetryPolicy<Self>
fn with_max_jitter(self, max_jitter: Duration) -> JitteredRetryPolicy<Self>
Returns a new
RetryPolicy that adds jitter(random delay) to underlying policy.Source§fn skip_retry_on_error<F>(self, function: F) -> FilteredRetryPolicy<Self, F>
fn skip_retry_on_error<F>(self, function: F) -> FilteredRetryPolicy<Self, F>
Skips retrying on errors that evaluate to
true after applying function.Auto Trait Implementations§
impl<T> Freeze for JitteredRetryPolicy<T>where
T: Freeze,
impl<T> RefUnwindSafe for JitteredRetryPolicy<T>where
T: RefUnwindSafe,
impl<T> Send for JitteredRetryPolicy<T>where
T: Send,
impl<T> Sync for JitteredRetryPolicy<T>where
T: Sync,
impl<T> Unpin for JitteredRetryPolicy<T>where
T: Unpin,
impl<T> UnwindSafe for JitteredRetryPolicy<T>where
T: UnwindSafe,
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