pub struct ExponentialRandomBackoff { /* private fields */ }Expand description
Exponential backoff with randomization to prevent thundering herd.
Implementations§
Source§impl ExponentialRandomBackoff
impl ExponentialRandomBackoff
Sourcepub fn new(initial_interval: Duration, randomization_factor: f64) -> Self
pub fn new(initial_interval: Duration, randomization_factor: f64) -> Self
Creates a new exponential random backoff.
§Arguments
initial_interval- The base intervalrandomization_factor- Factor for randomization (0.0 to 1.0) A factor of 0.5 means the interval will be randomized between 50% and 150% of the calculated value.
Sourcepub fn multiplier(self, multiplier: f64) -> Self
pub fn multiplier(self, multiplier: f64) -> Self
Sets the multiplier for exponential growth.
Sourcepub fn max_interval(self, max_interval: Duration) -> Self
pub fn max_interval(self, max_interval: Duration) -> Self
Sets the maximum interval to cap exponential growth.
Trait Implementations§
Source§impl Clone for ExponentialRandomBackoff
impl Clone for ExponentialRandomBackoff
Source§fn clone(&self) -> ExponentialRandomBackoff
fn clone(&self) -> ExponentialRandomBackoff
Returns a duplicate of the value. Read more
1.0.0 · 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 ExponentialRandomBackoff
impl Debug for ExponentialRandomBackoff
Auto Trait Implementations§
impl Freeze for ExponentialRandomBackoff
impl RefUnwindSafe for ExponentialRandomBackoff
impl Send for ExponentialRandomBackoff
impl Sync for ExponentialRandomBackoff
impl Unpin for ExponentialRandomBackoff
impl UnsafeUnpin for ExponentialRandomBackoff
impl UnwindSafe for ExponentialRandomBackoff
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