Skip to content
1 min read · 62 words

Function: computeBackoff()

ts
function computeBackoff(attempt: number, cfg: BackoffConfig): number;

Defined in: lib/utils/retry.ts:30

Exponential backoff with a ceiling: min(baseDelayMs * 2^(attempt-1), maxDelayMs).

Parameters

ParameterTypeDescription
attemptnumber1-based attempt number.
cfgBackoffConfigCarries baseDelayMs (default 500) and maxDelayMs (default 30_000).

Returns

number

The (un-jittered) delay in ms.