Skip to main content

with_retries

Function with_retries 

Source
pub(crate) async fn with_retries<F, Fut, T, E>(
    cfg: &RetryCfg,
    deadline: Option<Instant>,
    op: F,
) -> Result<T, E>
where F: FnMut() -> Fut, Fut: Future<Output = Result<T, (Retry, E)>>,
Expand description

Retry op with exponential backoff. Retry::Permanent returns at once; Retry::Transient retries until the tries run out or deadline passes, with sleeps truncated to it.