Skip to content

tinchogob/retrier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retrier

Build Status

Simple operation retrier till callback success or max attempts are reached

var retry = require('retrier');

var op = function(callback) {
  console.log("I've been called but I won't succed");
  return callback("Error");
}

retry(10, op, function(error, response){
  if (error) {
    return console.log("After 10 times I'm here");
  }
  
  return console.log("warning unreachable code")
});

##retrier(n, operation, callback);

Will call operation for n times untill it succeeds.

  • n: count to call operation
  • operation: single callback argument function (if you need args, check out async.apply, or function.bind)
  • callback: final callback to be called with response or error if operation failed for n times

PR's are welcomed

About

Node operation retrier till callback success or max attempts reached

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published