pub struct RetryConfig {
pub max_attempts: u32,
pub base_delay: Duration,
pub max_delay: Duration,
pub jitter: bool,
}Expand description
Retry policy configuration (truncated exponential backoff with jitter).
Under CacheKit::io, all attempts of one operation
also share one deadline: 5 s for a read (get, exists) and 10 s for a
write (set, delete), matching the cachekit.io backend’s per-attempt
timeouts. An attempt still running at the deadline is cancelled and the
operation fails with a Timeout error, and no backoff sleep starts that
would end past it. A cachekit.io request that stops answering therefore
costs one attempt, not max_attempts of them, while fast failures (a
503, a dropped connection) still get every attempt that fits. Other
backends, and a backend set on the builder after io, get no deadline:
their operations run to their own timeouts.
Fields§
§max_attempts: u32Total attempts, including the first (default: 3). 0 behaves as 1.
base_delay: DurationBackoff base delay; attempt n waits base_delay * 2^n (default: 100 ms).
max_delay: DurationBackoff ceiling (default: 5 s).
jitter: boolMultiply each delay by a random factor in [0.5, 1.5) (default: true).
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§impl Debug for RetryConfig
impl Debug for RetryConfig
Source§impl Default for RetryConfig
impl Default for RetryConfig
Source§impl PartialEq for RetryConfig
impl PartialEq for RetryConfig
impl StructuralPartialEq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more