RetryPolicy
RetryPolicy:
object
Defined in: Types/RetryPolicy.ts:34
Type Declaration
Section titled “Type Declaration”constant
Section titled “constant”constant: <
E>(options) =>RetryPolicy<E>
Creates a RetryPolicy with a constant delay between retry attempts.
Type Parameters
Section titled “Type Parameters”E = unknown
Parameters
Section titled “Parameters”options
Section titled “options”attempts
Section titled “attempts”number
onRetry?
Section titled “onRetry?”(event) => void
(error) => boolean
Returns
Section titled “Returns”RetryPolicy<E>
Example
Section titled “Example”exponential
Section titled “exponential”exponential: <
E>(options) =>RetryPolicy<E>
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.
An optional maxDelay caps the maximum duration between retry attempts.
An optional when predicate filters which errors qualify for retry.
An optional onRetry callback executes telemetry side-effects before each retry delay.
Type Parameters
Section titled “Type Parameters”E = unknown
Parameters
Section titled “Parameters”options
Section titled “options”attempts
Section titled “attempts”number
factor?
Section titled “factor?”number
initial
Section titled “initial”jitter?
Section titled “jitter?”boolean
maxDelay?
Section titled “maxDelay?”onRetry?
Section titled “onRetry?”(event) => void
(error) => boolean
Returns
Section titled “Returns”RetryPolicy<E>