1.0.0 • Published 6 years ago

backoff-time v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Build Status Known Vulnerabilities Coverage Status

backoff-time

Zero deps backoff time function

Install

$ npm install backoff-time

Usage

const minBackoff = 50;
const maxBackoff = 5000;
const backoff = require('backoff-time')(minBackoff, maxBackoff);
var attempt = 0;

function blah(...){
}
// every time blah fails we increment *attempt*
const wait = backoff(attempt);
// retry
setTimeout(fn, wait);