this repo has no description
at main 20 lines 405 B view raw
1use std::time::Duration; 2 3#[derive(Debug, Clone)] 4pub struct RetryPolicy { 5 pub max_retries: u32, 6 pub backoff: Duration, 7} 8 9impl RetryPolicy { 10 pub fn new(max_retries: u32, backoff: Duration) -> Self { 11 Self { 12 max_retries, 13 backoff, 14 } 15 } 16 17 pub fn should_retry(&self, failures_so_far: u32) -> bool { 18 failures_so_far <= self.max_retries 19 } 20}