Skip to content

Commit

Permalink
Fix retry delay function in the README (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
devjerry committed Aug 27, 2020
1 parent 0d43f5f commit 38bbb04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -513,7 +513,7 @@ An object representing `limit`, `calculateDelay`, `methods`, `statusCodes`, `max
If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`.\
If [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.

Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 1).
Delays between retries counts with function `1000 * Math.pow(2, retry - 1) + Math.random() * 100`, where `retry` is attempt number (starts from 1).

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).

Expand Down

0 comments on commit 38bbb04

Please sign in to comment.