AsyncRetryStrategy

Trait AsyncRetryStrategy 

Source
pub trait AsyncRetryStrategy: Send + Sync {
    // Required methods
    fn next_interval(
        &mut self,
        attempt: u32,
        last_interval: Duration,
    ) -> Duration;
    fn should_retry(
        &self,
        attempt: u32,
        elapsed: Duration,
        max_retries: Option<u32>,
        timeout: Duration,
    ) -> bool;
    fn reset(&mut self);
    fn name(&self) -> &'static str;
}
Expand description

Async trait for retry strategies

This allows for custom retry logic, exponential backoff algorithms, jitter, and other advanced retry patterns.

Required Methods§

Source

fn next_interval(&mut self, attempt: u32, last_interval: Duration) -> Duration

Calculate the next retry interval

Source

fn should_retry( &self, attempt: u32, elapsed: Duration, max_retries: Option<u32>, timeout: Duration, ) -> bool

Check if we should continue retrying

Source

fn reset(&mut self)

Reset strategy state for a new target

Source

fn name(&self) -> &'static str

Get strategy name for debugging

Implementors§