Skip to content

Documentation / @super-line/client / backoffDelay

Function: backoffDelay()

backoffDelay(attempt, opts): number

Defined in: packages/client/src/backoff.ts:19

Exponential backoff with full jitter: a random delay in [raw/2, raw], where raw = min(maxMs, baseMs * factor ** attempt). A pure function — easy to unit-test.

Parameters

attempt

number

0-based retry attempt.

opts

BackoffOptions

backoff tuning.

Returns

number

the delay in milliseconds before the next attempt.

Released under the MIT License.