/** * The allowed options object for `exponentialBackoffDelayCalculator` */ export interface DelayCalculator { jitter: boolean; jitterFactor: number; backOffFactor: number; baseWaitTime: number; } /** * Calculate retry timing * * `jitter`: "Slight irregular movement, variation, or unsteadiness, * especially in an electrical signal or electronic device" * * @param options - The options object * - `jitter`: If the duration should be affected by a jitter effect * - `jitterFactor`: How widely the jitter effect should vary * - `backOffFactor`: How quickly the duration should back off * - `baseWaitTime`: The base time when determining sleep duration * @returns The duration to sleep * * @example * const calcOpts: DelayCalculator = { * jitter: true, * jitterFactor: .3, * backOffFactor: 2, * baseWaitTime: 100, * } * // Create a retrier with a custom backoff * retryWithBackoff({retries: 3, delayCalculator: exponentialBackoffDelayCalculator(calcOpts)}) */ export declare const exponentialBackoffDelayCalculator: ({ jitter, jitterFactor, backOffFactor, baseWaitTime, }: Partial) => (attempt: number) => number;