Skip to content

Function: backoffFor() ​

ts
function backoffFor(
   attempt, 
   timings, 
   random?
): number;

The backoff step for attempt n (1-based), jittered.

The last step repeats rather than growing without bound: a client that has been away twenty minutes has nothing left to resume to, and one that comes back after an hour should still be trying every eight seconds rather than every four minutes.

Parameters ​

ParameterTypeDefault value
attemptnumberundefined
timingsTimingsundefined
random() => numberMath.random

Returns ​

number

Talkline documentation