Skip to main content

Module retry

Module retry 

Source
Expand description

Shared retry/backoff helpers built on top of the backon crate.

These constructors give the node a single definition of the “standard” backoff schedules so that retry behaviour stays consistent across components instead of being re-derived at each call site. Use them together with the Retryable suffix extension, e.g.

use miden_node_utils::retry::{self, Retryable};

let value = (|| async { do_thing().await })
    .retry(retry::exponential(min, max))
    .when(|err| is_transient(err))
    .notify(|err, dur| tracing::warn!(?dur, %err, "retrying"))
    .await?;

Traits§

BackoffBuilder
BackoffBuilder is utilized to construct a new backoff.
Retryable
Retryable will add retry support for functions that produce futures with results.

Functions§

constant
Builds a constant-delay backoff schedule.
exponential
Builds an exponential backoff schedule that retries indefinitely.
exponential_bounded
Same as exponential, but stops after max_times retries (i.e. max_times + 1 total attempts).