Skip to main content

with_retries

Function with_retries 

Source
pub async fn with_retries<T, E, F, Fut>(
    attempts: u32,
    delay: Duration,
    label: &str,
    operation: F,
) -> Result<T, E>
where F: FnMut() -> Fut, Fut: Future<Output = Result<T, E>>, E: Display,
Expand description

Run an async operation, retrying on error up to attempts times, delay apart. Each failure is reported; the last error is returned once attempts are exhausted.