pub struct PythLazerExponentialBackoffBuilder { /* private fields */ }
Expand description
Builder for PythLazerExponentialBackoff
.
Provides a fluent interface for configuring exponential backoff parameters with sensible defaults from the backoff crate.
Implementations§
Source§impl PythLazerExponentialBackoffBuilder
impl PythLazerExponentialBackoffBuilder
Sourcepub fn with_initial_interval(&mut self, initial_interval: Duration) -> &mut Self
pub fn with_initial_interval(&mut self, initial_interval: Duration) -> &mut Self
Sets the initial retry interval.
This is the starting interval for the first retry attempt.
Sourcepub fn with_randomization_factor(
&mut self,
randomization_factor: f64,
) -> &mut Self
pub fn with_randomization_factor( &mut self, randomization_factor: f64, ) -> &mut Self
Sets the randomization factor to use for creating a range around the retry interval.
A randomization factor of 0.5 results in a random period ranging between 50% below and 50% above the retry interval. This helps avoid the “thundering herd” problem when multiple clients retry at the same time.
Sourcepub fn with_multiplier(&mut self, multiplier: f64) -> &mut Self
pub fn with_multiplier(&mut self, multiplier: f64) -> &mut Self
Sets the value to multiply the current interval with for each retry attempt.
A multiplier of 2.0 means each retry interval will be double the previous one.
Sourcepub fn with_max_interval(&mut self, max_interval: Duration) -> &mut Self
pub fn with_max_interval(&mut self, max_interval: Duration) -> &mut Self
Sets the maximum value of the back off period.
Once the retry interval reaches this value it stops increasing, providing an upper bound on the wait time between retries.
Sourcepub fn build(&self) -> PythLazerExponentialBackoff
pub fn build(&self) -> PythLazerExponentialBackoff
Builds the PythLazerExponentialBackoff
configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PythLazerExponentialBackoffBuilder
impl RefUnwindSafe for PythLazerExponentialBackoffBuilder
impl Send for PythLazerExponentialBackoffBuilder
impl Sync for PythLazerExponentialBackoffBuilder
impl Unpin for PythLazerExponentialBackoffBuilder
impl UnwindSafe for PythLazerExponentialBackoffBuilder
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> 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