Skip to main content

Module backoff_table

Module backoff_table 

Source
Expand description

BackoffTable - per-peer exponential backoff state used by wire syscalls + transport adapters per ENGINE.md §10.2.

Each peer tracks consecutive failures, the timestamp of the most recent attempt, and the computed next-retry time. The backoff schedule is exponential with a configurable base and cap:

delay(n) = min(BASE_NS * 2^n, MAX_DELAY_NS)

On success, clear(peer) resets state. On failure, record_failure(peer, now_ns) bumps the attempt counter + schedules the next retry. should_retry(peer, now_ns) reports whether the cooldown has elapsed (peers never seen before are always allowed to retry).

Structs§

BackoffState
Per-peer backoff bookkeeping.
BackoffTable
Per-peer exponential backoff table.

Constants§

DEFAULT_BASE_NS
Default base delay (10 ms) for the first retry after a failure.
DEFAULT_MAX_DELAY_NS
Default cap (60 s). Stops the doubling from running away on long outages.