Skip to content

Files

Latest commit

Taha Dhiaeddine AmdouniTaha Dhiaeddine Amdouni
Taha Dhiaeddine Amdouni
and
Taha Dhiaeddine Amdouni
Sep 20, 2017
1c4cfe1 · Sep 20, 2017

History

History
executable file
·
34 lines (23 loc) · 503 Bytes

File metadata and controls

executable file
·
34 lines (23 loc) · 503 Bytes

backo

Simple exponential backoff because the others seem to have weird abstractions.

Installation

$ npm install backo

Options

  • min initial timeout in milliseconds [100]
  • max max timeout [10000]
  • jitter [0]
  • factor [2]

Example

var Backoff = require('backo');
var backoff = new Backoff({ min: 100, max: 20000 });

setTimeout(function(){
  something.reconnect();
}, backoff.duration());

// later when something works
backoff.reset()

License

MIT