Type Alias: RetryOptions<T>
RetryOptions<
T> =object
Defined in: packages/promise/dist/index.d.ts:161
Options for automatic retry mechanism
Type Parameters
T
T = unknown
Properties
retry?
optionalretry:number
Defined in: packages/promise/dist/index.d.ts:169
Maximum number of retries.
The total number of attempts will be retry + 1.
Default: 1
retryBackOff?
optionalretryBackOff:"exponential"|"linear"
Defined in: packages/promise/dist/index.d.ts:176
Accepted values:
- exponential: each subsequent retry delay will be doubled from the last
- linear: fixed delay between retries Default: 'exponential'
retryDelay?
optionalretryDelay:number
Defined in: packages/promise/dist/index.d.ts:183
The base delay in milliseconds between retries. Default: 300
Setting this to 0 disables the delay mechanism entirely, including jitter.
retryDelayJitter?
optionalretryDelayJitter:boolean
Defined in: packages/promise/dist/index.d.ts:191
Whether to add a random delay between 0ms and retryDelayJitterMax to the retryDelay.
This helps to avoid "thundering herd" problem when multiple retries are attempted simultaneously.
Default: true
retryDelayJitterMax?
optionalretryDelayJitterMax:number
Defined in: packages/promise/dist/index.d.ts:199
Maximum jitter delay (in milliseconds) to be added to the retryDelay when retryDelayJitter is true.
A random value between 0 and retryDelayJitterMax will be added to the base retryDelay.
Default: 100
retryIf?
optionalretryIf:RetryIfFunc<T>
Defined in: packages/promise/dist/index.d.ts:215
Additional condition to be used to determine whether function should be retried.
If retryIf not provided, execution will be retried on any error until the retry limit is reached or a result is received without an exception.
Param
The result from the previous attempt, if any.
Param
The number of retries that have been attempted so far.
Param
The error from the previous attempt, if any.
Expected return values:
true: retry will be attempted regardless of error.false: no further retry will be attempted and the last error/result will be returned.void | undefined: retry will be attempted only if there was an error.