Skip to content

RetryPolicy

RetryPolicy: object

Defined in: Types/RetryPolicy.ts:14

constant: (options) => RetryPolicy

Creates a RetryPolicy with a constant delay between retry attempts.

number

Duration

RetryPolicy

const policy = RetryPolicy.constant({
  attempts: 3,
  delay: Duration.seconds(1),
});

exponential: (options) => RetryPolicy

Creates a RetryPolicy with exponential backoff delays between attempts. An optional factor (default 2) controls the growth rate. An optional jitter (default false) adds randomized variance to prevent thundering herd problems.

number

number

Duration

boolean

RetryPolicy

const policy = RetryPolicy.exponential({
  attempts: 5,
  initial: Duration.milliseconds(100),
  factor: 2,
  jitter: true,
});