Skip to content

RetryPolicy

RetryPolicy<E> = object

Defined in: Types/RetryPolicy.ts:34

An immutable policy describing retry limits, backoff delay strategies, transient failure filters, and observational telemetry.

const policy: RetryPolicy<Error> = RetryPolicy.exponential({
  attempts: 3,
  initial: Duration.milliseconds(100),
  when: (err) => err.name === "NetworkError",
  onRetry: (event) => console.warn(`Retrying attempt ${event.attempt}: ${event.error.message}`),
});

E = unknown

readonly attempts: number

Defined in: Types/RetryPolicy.ts:35


readonly getDelay: (attempt) => Duration

Defined in: Types/RetryPolicy.ts:36

number

Duration


readonly optional onRetry?: (event) => void

Defined in: Types/RetryPolicy.ts:38

RetryEvent<E>

void


readonly optional when?: (error) => boolean

Defined in: Types/RetryPolicy.ts:37

E

boolean