node-backoff
Simple backoff in node.js
Install
$ npm i node-backoff --save
Options
- min min timeout in milliseconds, defaut:100
- max max timeout in milliseconds, default:10000
- factor every call to
duration()
it is multiplied by factor, default:2 - jitter randomization to the backoff durations,default:false
Using
const Backoff = require; let backoff = new let d1 = //100ms let d2 = //200ms let d3 = //400ms let d4 = //800ms //or let t1 = backoff.forAttempt;//400ms // reset attempts