amqpx / index / retryStrategies / cappedExponentialBackoff
Function: cappedExponentialBackoff()
cappedExponentialBackoff(
multiplier,maxDelay,base?,jitter?): (step) =>number
Defined in: src/retry/time-strategies.ts:65
Increases the delay each step using the formula multiplier * base^(step-1), capped at maxDelay. Behaves identically to exponentialBackoff but clamps the result to maxDelay before applying jitter. For base=2, multiplier=100, and maxDelay=500 results in the series: 100, 200, 400, 500, 500, ...
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
multiplier | number | undefined | Multiplier of the function, specifying the delay at the first step. |
maxDelay | number | undefined | Maximum delay in ms. The raw exponential value is clamped to this before jitter is applied. |
base | number | 2 | Base of the exponential function. Default is 2, resulting in doubling the time each step. |
jitter | number | 0.25 | Jitter factor in [0, 1]. Randomizes the delay within ±jitter * delay. Use 0 to disable jitter. |
Returns
(step) => number