The following keys are available in the IBackOffOptions interface to configure the retry strategy:
interface IBackOffOptions {
/** Decides whether the `startingDelay` should be applied before the first call. Defaults to `false`. */
delayFirstAttempt: boolean;
/** Decides whether a jitter should be applied. Possible values: `"full"`, `"none"`. Defaults to `"none"`. */
jitter: JitterType;
/** The maximum delay, in milliseconds, between two consecutive attempts. Defaults to `Infinity`. */
maxDelay: number;
/** The maximum number of times to attempt the function. Must be at least `1`. Defaults to `10`. */
numOfAttempts: number;
/**
* Logic to run after every failed attempt.
* Called with `(e: any, attemptNumber: number)`.
* Return `true` to retry, `false` to stop.
* Defaults to a function that always returns `true`.
*/
retry: (e: any, attemptNumber: number) => boolean | Promise<boolean>;
/** The delay, in milliseconds, before executing the function for the first time. Defaults to `100`. */
startingDelay: number;
/** The multiplier applied to the delay between reattempts. Defaults to `2`. */
timeMultiple: number;
}