RetryPolicy interface

Interface describing a retry policy object. Retry policies are composed of 2 things

  • An algorithm that computes the next time to retry based on the current number or retries.
  • An error filter that decides, based on the type of error received, whether a retry should happen or not.

Those 2 components hide behind 2 method calls described in this interface.

Properties

nextRetryTimeout

Computes the interval to wait before retrying at each new retry tentative.

shouldRetry

Based on the error passed as argument, determines if an error is transient and if the operation should be retried or not.

Property Details

nextRetryTimeout

Computes the interval to wait before retrying at each new retry tentative.

nextRetryTimeout: (retryCount: number, isThrottled: boolean) => number

Property Value

(retryCount: number, isThrottled: boolean) => number

shouldRetry

Based on the error passed as argument, determines if an error is transient and if the operation should be retried or not.

shouldRetry: (error: Error) => boolean

Property Value

(error: Error) => boolean