Skip to main content

retry

Function retry 

Source
pub async fn retry<T, E, F, Fut>(
    op: F,
    max_attempts: u32,
    schedule: RetrySchedule,
) -> Result<T, E>
where F: FnMut() -> Fut, Fut: Future<Output = Result<T, E>>,
Expand description

Run op, retrying up to max_attempts total times (including the initial call). Returns the last error if every attempt fails.

max_attempts == 1 means “no retries” — op runs exactly once.