Skip to content

amqpx v1.0.1


amqpx / index / retryStrategies / exponentialBackoff

Function: exponentialBackoff()

exponentialBackoff(multiplier, base?, jitter?): (step) => number

Defined in: src/retry/time-strategies.ts:50

Increases the delay each step using the formula multiplier * base^(step-1). For base=2 and multiplier=100 results in the series: 100, 200, 400, 800, ...

Parameters

ParameterTypeDefault valueDescription
multipliernumberundefinedMultiplier of the function, specifying the delay at the first step. Default is 100.
basenumber2Base of the exponential function. Default is 2, resulting in doubling the time each step.
jitternumber0.25Jitter factor in [0, 1]. Randomizes the delay within ±jitter * delay. Use 0 to disable jitter.

Returns

(step) => number

Released under the MIT License.