Skip to content

Commit

Permalink
Clarify the retry mechanism
Browse files Browse the repository at this point in the history
Fixes #1143
  • Loading branch information
szmarczak committed Sep 9, 2020
1 parent 2b352d3 commit f248618
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions readme.md
Expand Up @@ -519,6 +519,8 @@ Delays between retries counts with function `1000 * Math.pow(2, retry - 1) + Mat

The `calculateDelay` property is a `function` that receives an object with `attemptCount`, `retryOptions`, `error` and `computedValue` properties for current retry count, the retry options, error and default computed value. The function must return a delay in milliseconds (or a Promise resolving with it) (`0` return value cancels retry).

**Note:** The `calculateDelay` function is responsible for the entire cache mechanism, including the `limit` property. To support it, you need to check whether `computedValue` is different than `0`.

By default, it retries *only* on the specified methods, status codes, and on these network errors:
- `ETIMEDOUT`: One of the [timeout](#timeout) limits were reached.
- `ECONNRESET`: Connection was forcibly closed by a peer.
Expand Down

0 comments on commit f248618

Please sign in to comment.