Skip to content

RetryOptions

Defined in: core/src/retry.ts:24

optional baseDelayMs?: number;

Defined in: core/src/retry.ts:27


optional budgetMs?: number;

Defined in: core/src/retry.ts:41

How long recovery may go on, counted from the FIRST failure. A retry starts only if it would start before then, its wait included. An attempt already running is never cut. Default 60s; Infinity turns it off.

Without it the worst case is every attempt in full plus every wait: three stalled streams at the watchdog’s 300s each is a quarter of an hour before the caller hears anything. The clock starts at the first failure, not at the call, so a long healthy run that then fails still gets its recovery.


optional maxAttempts?: number;

Defined in: core/src/retry.ts:26

Total attempts including the first. Default 3.


optional maxDelayMs?: number;

Defined in: core/src/retry.ts:30

Maximum acceptable wait. A longer server deadline ends retry so an outer fallback can switch provider; it is never shortened to retry too early.


optional onRetry?: (info) => void;

Defined in: core/src/retry.ts:46

Parameter Type
info { attempt: number; delayMs: number; error: unknown; }
info.attempt number
info.delayMs number
info.error unknown

void


optional shouldRetry?: (err, attempt) => boolean;

Defined in: core/src/retry.ts:45

Decide retryability. Default: transient kinds only.

Parameter Type
err unknown
attempt number

boolean


optional signal?: AbortSignal;

Defined in: core/src/retry.ts:43

Aborts the wait as well as the work, so Stop lands promptly.


optional sleep?: (ms, signal?) => Promise<void>;

Defined in: core/src/retry.ts:48

Injected in tests so a suite never really waits.

Parameter Type
ms number
signal? AbortSignal

Promise<void>