retry-me
v1.0.0
Published
Single export interface to the retry module
Downloads
5
Readme
retry-me
Single export interface to the retry module
Example
var retryMe = require('retry-me')
var request = require('request')
var fn = function(callback) {
request('http://bluthipsum.com', function(err, res, body) {
if (!err && res.statusCode !== 200) {
err = new Error('Request failed with ' + res.statusCode)
}
callback(err, body)
})
}
retryMe(fn, function(err, body, errors) {
console.log(body)
})
You can also provide retry options:
var options = {
retries: 2,
factor: 2,
minTimeout: 1000,
maxTimeout: 2000,
randomize: true
}
retryMe(fn, options, function(err, body, errors) {
console.log(body)
})
License
MIT