Skip to main content

Module retry

Module retry 

Source
Expand description

Operation-level retry loops for business-layer flows (balance polling, faucet waits, bid submission races, etc.).

§Not to be confused with taskfast_client::retry

The client’s retry is scoped to HTTP transport: it retries only Server/Network/RateLimited errors and exists to smooth over flaky endpoints. This one wraps arbitrary async operations and retries on any error. The policies differ in kind, not degree:

  • HTTP retry = “the request didn’t land, try again”
  • Agent retry = “the goal wasn’t met yet (e.g., balance still zero), try again — regardless of why”

§RateLimited special-case

If the returned error is Error::RateLimited with a retry_after, the loop sleeps that exact duration instead of the next exponential step. This matches the semantic of the platform’s 429 handler: the server told us when to come back, so we respect it.

Structs§

BackoffOptions
Knobs for with_backoff. Defaults tuned for the worker hot loop: 5 attempts over ~15 s of exponential wait (0.5 → 1 → 2 → 4 → 8 s) is usually enough for transient hiccups without wedging an event-handler on a genuine outage.

Functions§

with_backoff
Run op until it succeeds or max_attempts is exhausted.