Relyra.Metadata.Backoff (relyra v1.1.0)

Copy Markdown View Source

Pure exponential-backoff schedule for Phase 21 auto-suspend per D-25.

Tiers: 1h → 6h → 24h cap. After 5 consecutive transient failures (the suspend threshold), the tier index advances by one each subsequent consecutive failure, capped at the 24h tier. ±10% jitter per AWS Builder's Library "Timeouts, retries and backoff with jitter" (D-25).

Pure: no I/O, no Ecto. Deterministic-with-jitter (Enum.random/1 is the only nondeterminism source).

Summary

Functions

Returns the absolute DateTime at which the source becomes eligible for a half-open probe (D-25 soft-backoff semantics — scheduler skips the source until this passes, then runs ONE probe). ±10% jitter (D-25).

Functions

backoff_until(consecutive_failures, base \\ DateTime.utc_now())

@spec backoff_until(non_neg_integer(), DateTime.t()) :: DateTime.t()

Returns the absolute DateTime at which the source becomes eligible for a half-open probe (D-25 soft-backoff semantics — scheduler skips the source until this passes, then runs ONE probe). ±10% jitter (D-25).

suspend_threshold()

@spec suspend_threshold() :: pos_integer()

tier_seconds(consecutive_failures)

@spec tier_seconds(non_neg_integer()) :: pos_integer()