retry-request
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -10,2 +10,3 @@ declare module 'retry-request' { | ||
retries?: number, | ||
noResponseRetries?: number, | ||
shouldRetryFn?: (response: request.RequestResponse) => boolean | ||
@@ -12,0 +13,0 @@ } |
@@ -10,2 +10,3 @@ 'use strict'; | ||
retries: 2, | ||
noResponseRetries: 2, | ||
shouldRetryFn: function (response) { | ||
@@ -59,4 +60,2 @@ var retryRanges = [ | ||
var MAX_NO_RESPONSE_RETRIES = 2; | ||
var numAttempts = 0; | ||
@@ -157,3 +156,3 @@ var numNoResponseAttempts = 0; | ||
if (numNoResponseAttempts <= MAX_NO_RESPONSE_RETRIES) { | ||
if (numNoResponseAttempts <= opts.noResponseRetries) { | ||
retryAfterDelay(numNoResponseAttempts); | ||
@@ -160,0 +159,0 @@ } else { |
{ | ||
"name": "retry-request", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Retry a request.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,2 +43,21 @@ |![retry-request](logo.png) | ||
#### `opts.noResponseRetries` | ||
Type: `Number` | ||
Default: `2` | ||
The number of times to retry after a response fails to come through, such as a DNS resolution error or a socket hangup. | ||
```js | ||
var opts = { | ||
noResponseRetries: 0 | ||
}; | ||
request(url, opts, function (err, resp, body) { | ||
// url was requested 1 time before giving up and | ||
// executing this callback. | ||
}); | ||
``` | ||
#### `opts.objectMode` | ||
@@ -45,0 +64,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10305
174
137