Shared status-polling engine for cross-chain settlement.
Settlement is observed only by polling (Riddler has no client-facing push), so to see a sub-three-second settlement the loop polls fast inside a short budget window, then widens for the long tail to avoid hammering the service:
- For the first
:budget_ms, poll every:fast_interval_ms. - After that, poll every
:slow_interval_msuntil:timeout_ms. - An HTTP 429 is treated as a transient backoff, not a failure.
run/3 returns {:ok, status, elapsed_ms} when terminal? first holds, so the
caller can classify the settlement as within-budget or slow. It returns
{:error, :timeout} at the ceiling and {:error, reason} on a non-retryable
fetch error.
Summary
Functions
Default budget window in milliseconds.
Poll fetch until terminal? holds, the deadline passes, or a fetch fails.
Types
@type result() :: {:ok, term(), non_neg_integer()} | {:error, term()}
Functions
@spec default_budget_ms() :: pos_integer()
Default budget window in milliseconds.
Poll fetch until terminal? holds, the deadline passes, or a fetch fails.
fetch is a 0-arity function returning {:ok, status} | {:error, reason};
terminal? takes a status and returns a boolean.