RetryOptions

import { RetryOptions } from "jsr:@ende/async";

interface

interface RetryOptions

Options for retry.

Properties

multiplier

multiplier?: number

How much to backoff after each retry.

Default: 2

maxTimeout

maxTimeout?: number

The maximum milliseconds between attempts.

Default: 60000

maxAttempts

maxAttempts?: number

The maximum amount of attempts until failure.

Default: 5

minTimeout

minTimeout?: number

The initial and minimum amount of milliseconds between attempts.

Default: 1000

jitter

jitter?: number

Amount of jitter to introduce to the time between attempts. This is 1 for full jitter by default.

Default: 1

isRetriable

isRetriable?: (err: unknown) => boolean

Callback to determine if an error or other thrown value is retriable.

Default: () => true

Returns

true if the error is retriable, false otherwise.

signal

signal?: AbortSignal

An AbortSignal to cancel the retry operation.

If the signal is aborted, the retry will stop and reject with the signal's reason. The signal is checked before each attempt and during the delay between attempts.

Default: undefined

Source