miniproto.media.retry.backoff_delay
miniproto.media.retry.backoff_delay
Section titled “miniproto.media.retry.backoff_delay”backoff_delay(attempt: int, *, base: float = DEFAULT_BACKOFF_BASE, cap: float = DEFAULT_BACKOFF_CAP, jitter: float = DEFAULT_BACKOFF_JITTER) -> floatCalculate a jittered exponential delay for a transient non-flood retry.
Parameters:
- attempt (
int) – Zero-based failed attempt;0produces approximatelybaseseconds. - base (
float) – Initial delay in seconds; defaults to :data:DEFAULT_BACKOFF_BASE. - cap (
float) – Maximum unjittered delay in seconds; defaults to :data:DEFAULT_BACKOFF_CAP. - jitter (
float) – Symmetric random fraction applied to the capped delay; defaults to :data:DEFAULT_BACKOFF_JITTER.
Returns:
float– A non-negative sleep duration in seconds. Randomization prevents synchronized retries.