Skip to main content

Module backoff

Module backoff 

Source
Expand description

Exponential backoff with jitter, and the “has this retry window run out” check that goes with it. Shared by every worker that reschedules a failed row instead of giving up on it outright.

Functions§

exponential_backoff_secs
base_secs * 2^attempt, capped at max_secs. attempt is clamped to keep the shift in range of i64.
next_attempt_at
now + delay_secs, plus a uniformly random 0..=jitter_max_secs so a batch that failed together does not all come back at once.
window_expired
Whether max_age_secs have passed since reference. None (never failed) is never expired.