retry_future 0.4.0

Retry futures mechanism
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::{RetryStrategy, TooManyAttempts};
use std::time::Duration;

/// Infinite retry
pub struct InfiniteRetryStrategy {
    pub duration_between_retries: Duration,
}

impl RetryStrategy for InfiniteRetryStrategy {
    fn check_attempt(&mut self, _attempts_before: usize) -> Result<Duration, TooManyAttempts> {
        Ok(self.duration_between_retries)
    }

    fn retry_early_returned_errors(&self) -> bool {
        true
    }
}