pub struct RetryPolicy {
pub max_retries: u32,
pub base_ms: u64,
pub cap_ms: u64,
pub jitter_permille: u64,
}Expand description
Retry with exponential backoff and jitter.
Fields§
§max_retries: u32§base_ms: u64§cap_ms: u64§jitter_permille: u64Largest fraction (per mille) a delay may shrink by.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn delay_ms(&self, failures: u32, rand_permille: u32) -> Option<u64>
pub fn delay_ms(&self, failures: u32, rand_permille: u32) -> Option<u64>
Delay before retry number failures (0 after the first failure); None when retries are
spent. rand_permille is the caller’s random draw in 0..=1000.
Sourcepub const fn is_retryable(status: u16) -> bool
pub const fn is_retryable(status: u16) -> bool
Network failure (status 0), timeout, rate limit and server errors are worth retrying.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
impl Copy for RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
impl Eq for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl Forget for RetryPolicy
impl Freeze for RetryPolicy
impl Move 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