-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
# RetriableRequest | ||
# Request-retry [](https://david-dm.org/FGRibreau/request-retry) | ||
|
||
When the connection fails with one of `ECONNRESET`, `ENOTFOUND`, `ESOCKETTIMEDOUT`, `ETIMEDOUT`, `ECONNREFUSED` or when an HTTP 5xx error occurrs, the request will automatically be re-attempted as these are often recoverable errors and will go away on retry. | ||
|
||
# Usage | ||
|
||
'ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED' | ||
Request-retry is a drop-in replacement for Request, it just adds two new options `maxAttempts` and `retryDelay`. | ||
|
||
## Installation | ||
```javascript | ||
var request = require('requestretry'); | ||
|
||
request({ | ||
url: 'https://api.domain.com/v1/a/b' | ||
json:true, | ||
|
||
Install with [npm](https://npmjs.org/package/retriablerequest). | ||
// The above parameters are specific to Request-retry: | ||
maxAttempts: 5, // (default) try 5 times | ||
retryDelay: 5000 // (default) wait for 5s before trying again | ||
}, function(err, response, body){ | ||
// this callback will only be called when the request succeeded or after maxAttempts. | ||
}); | ||
``` | ||
|
||
## Installation | ||
|
||
npm install --save retriablerequest | ||
Install with [npm](https://npmjs.org/package/requestretry). | ||
|
||
npm install --save requestretry | ||
|
||
## Changelog | ||
|
||
v0.0.1: Initial commit | ||
v1.0.0: Initial commit | ||
|
||
Copyright 2014, [Francois-Guillaume Ribreau](http://) ([email protected]) | ||
Copyright 2014, [Francois-Guillaume Ribreau](http://fgribreau.com) ([email protected]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name": "retriablerequest", | ||
"description": "Retriable Request", | ||
"name": "requestretry", | ||
"description": "request-retry wrap nodejs request to retry http(s) requests in case of error", | ||
"author": { | ||
"name": "Francois-Guillaume Ribreau", | ||
"email": "[email protected]", | ||
"url": "http://fgribreau.com" | ||
}, | ||
"version": "0.0.1", | ||
"repository": { | ||
"url": "https://github.com/FGRibreau/node-retriablerequest" | ||
"url": "https://github.com/FGRibreau/node-request-retry" | ||
}, | ||
"main": "index.js", | ||
"license": "MIT", | ||
|