Struct backoff::exponential::ExponentialBackoff
source · pub struct ExponentialBackoff<C> {
pub current_interval: Duration,
pub initial_interval: Duration,
pub randomization_factor: f64,
pub multiplier: f64,
pub max_interval: Duration,
pub start_time: Instant,
pub max_elapsed_time: Option<Duration>,
pub clock: C,
}Fields§
§current_interval: DurationThe current retry interval.
initial_interval: DurationThe initial retry interval.
randomization_factor: f64The 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.
multiplier: f64The value to multiply the current interval with for each retry attempt.
max_interval: DurationThe maximum value of the back off period. Once the retry interval reaches this value it stops increasing.
start_time: InstantThe system time. It is calculated when an ExponentialBackoff instance is
created and is reset when retry is called.
max_elapsed_time: Option<Duration>The maximum elapsed time after instantiating ExponentialBackfff or calling
reset after which next_backoff returns None.
clock: CThe clock used to get the current time.
Implementations§
source§impl<C: Clock> ExponentialBackoff<C>
impl<C: Clock> ExponentialBackoff<C>
sourcepub fn get_elapsed_time(&self) -> Duration
pub fn get_elapsed_time(&self) -> Duration
Returns the elapsed time since start_time.