seuss-backoff

1.0.1 • Public • Published

Seuss Backoff

Exponential backoff queue.

Usage

var Backoff = require('seuss-backoff');

// using sensible defaults
var queue = Backoff({
    onitem: function(item, cb) {
        // try and process item
        // cb(true) to succeed or cb(false) to fail and retry
        cb(false);
    }
});

Options

Defaults shown. Seuss can either be the in-memory queue (seuss-queue) or the file backed queue (seuss).

var Seuss = require('seuss-queue');
var Backoff = require('seuss-backoff');
var queue = Backoff({
    inflight: Seuss(), // items to process
    retrying: Seuss(), // items awaiting retry
    backoff: 500, // initial retry timeout in ms
    factor: 1.5, // factor to increase each successive timeout
    limit: 1000 * 60, // maximum timeout in ms
    notify: 1000 * 30, // timeout in ms to start printing to stderr
    onitem: function(item, cb) {
        // try and process item
        // cb(true) to succeed or cb(false) to fail and retry
        cb(false);
    }
});

Readme

Keywords

Package Sidebar

Install

npm i seuss-backoff

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • ascendzor
  • tcoats