Skip to content

Commit

Permalink
reduce retries number and make delays shorter
Browse files Browse the repository at this point in the history
Closes #222
  • Loading branch information
floatdrop committed May 7, 2017
1 parent 7024f5f commit 130c426
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -215,7 +215,7 @@ function normalizeArguments(url, opts) {
opts = Object.assign(
{
path: '',
retries: 5
retries: 3
},
url,
{
Expand Down Expand Up @@ -296,7 +296,7 @@ function normalizeArguments(url, opts) {

const noise = Math.random() * 100;

return ((1 << iter) * 1000) + noise;
return ((1 << iter) * 500) + noise;
};
}

Expand Down
4 changes: 2 additions & 2 deletions readme.md
Expand Up @@ -132,9 +132,9 @@ Option accepts `object` with separate `connect` and `socket` fields for connecti
###### retries

Type: `number`, `function`<br>
Default: `5`
Default: `3`

Number of request retries when network errors happens. Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 0).
Number of request retries when network errors happens. Delays between retries counts with function `500 * Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 0).

Option accepts `function` with `retry` and `error` arguments. Function must return delay in milliseconds (`0` return value cancels retry).

Expand Down

0 comments on commit 130c426

Please sign in to comment.