Retry with Backoff & Jitter
A generic `retry(task, options)` that re-runs a failing async task with exponential backoff and full jitter, an optional `shouldRetry` predicate, and a cap on any single delay.
3 min read
#toolingRetrying on a fixed interval turns one flaky dependency into a synchronised stampede - every client retries at the same instant. Exponential backoff spaces the attempts out; jitter, a random delay inside the backoff window, is what stops all the clients lining up on the same schedule again.
@itsnas usage.ts
codeusage.ts
main
Nas (@itsnas)
main
Nas (@itsnas)