Retry async operations with custom backoff strategies
npm install retry-on-error
|4||downloads in the last month|
|Version||0.0.2 last updated a year ago|
retry on error
[work in progress] Wrap an async function with retry logic.
$ npm install retry-on-error
var retry = require('retry-on-error');
- timeout -- a number representing the time in ms to wait between retrys or a function that accepts the attempt number as its only parameter and returns the time in ms to wait after that attempt number. Numbers are use for static timeouts, and functions can be used for custom backoff strategies. This module also includes functions to create common backoff strategies. See backoff strategy section below.
- accept -- predicate function that takes the same arguments as the callback, and returns truthy if the execution should be accepted as success and falsey if the execution should be considered a failure/error. The default accept function follows the node callback pattern where the first parameter to the callback represents an error.
- minTimeout and maxTimtout -- used to coerce the result of the timeout function.
- maxAttempts -- the maximum number number of attempts before giving up and returning the last error.