From c90d1d74c6c8e5f93c23493c431371666dc6b5a3 Mon Sep 17 00:00:00 2001 From: Frank van Wijk Date: Mon, 31 Oct 2022 09:05:48 +0100 Subject: [PATCH] Tweak docs wording a bit more --- .vscode/settings.json | 3 --- readme.md | 3 ++- source/types/retry.ts | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 8d9c9bc0..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "editor.formatOnSave": false -} \ No newline at end of file diff --git a/readme.md b/readme.md index ec23159d..c428fa41 100644 --- a/readme.md +++ b/readme.md @@ -177,8 +177,9 @@ If `retry` is a number, it will be used as `limit` and other defaults will remai 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. -By default, the delay is calculated with `0.3 * (2 ** (attemptCount - 1)) * 1000`. The delay increases exponentially. +The `backoffLimit` option is the upper limit of the delay per retry in milliseconds. To clamp the delay, set `backoffLimit` to 1000, for example. +By default, the delay is calculated with `0.3 * (2 ** (attemptCount - 1)) * 1000`. The delay increases exponentially. Retries are not triggered following a [timeout](#timeout). diff --git a/source/types/retry.ts b/source/types/retry.ts index f6a0481a..746a1ec6 100644 --- a/source/types/retry.ts +++ b/source/types/retry.ts @@ -36,6 +36,7 @@ export interface RetryOptions { /** The upper limit of the delay per retry in milliseconds. + To clamp the delay, set `backoffLimit` to 1000, for example. By default, the delay is calculated in the following way: @@ -45,7 +46,7 @@ export interface RetryOptions { The delay increases exponentially. - To clamp the delay, set `backoffLimit` to 1000, for example. + @default Infinity */ backoffLimit?: number; }