pub async fn retry_async<T, Fut>(
policy: &RetryPolicy,
should_retry: impl Fn(&Error) -> bool,
op: impl FnMut() -> Fut,
) -> Result<T>Expand description
Run op, retrying its result while should_retry says so and policy has
attempts left, sleeping the (jittered, exponential) backoff between tries. The
op is re-invoked from scratch each attempt, so it must be idempotent for the
errors should_retry selects (lock-contention failures are — the command never
ran). Returns the first Ok, or the last Err.