You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
503 B

7 years ago
  1. # backo
  2. Simple exponential backoff because the others seem to have weird abstractions.
  3. ## Installation
  4. ```
  5. $ npm install backo
  6. ```
  7. ## Options
  8. - `min` initial timeout in milliseconds [100]
  9. - `max` max timeout [10000]
  10. - `jitter` [0]
  11. - `factor` [2]
  12. ## Example
  13. ```js
  14. var Backoff = require('backo');
  15. var backoff = new Backoff({ min: 100, max: 20000 });
  16. setTimeout(function(){
  17. something.reconnect();
  18. }, backoff.duration());
  19. // later when something works
  20. backoff.reset()
  21. ```
  22. # License
  23. MIT