Skip to main content

BackoffStrategy

Trait BackoffStrategy 

Source
pub trait BackoffStrategy: Send + Sync {
    // Required method
    fn delay_for_attempt(&self, attempt_number: u32) -> Duration;
}
Expand description

A strategy for computing retry delay based on attempt number.

Required Methods§

Source

fn delay_for_attempt(&self, attempt_number: u32) -> Duration

Returns the delay before the given attempt should be retried.

attempt_number is 1-indexed: the first retry after the initial attempt is attempt_number = 1.

Implementors§