This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

requestqueue

0.0.3 • Public • Published

requestqueue

npm version dependencies

npm

Run requests in sequence and retry them if they fail using request-retry module.

This is useful when requests need to be send in a guaranteed order, for example when sending status updates.

The response should not be expected to arrive immediately (nor soon), since there may be other requests in the queue or the response may arrive after several retries.

Installation

$ npm install requestqueue

Example

RequestQueue = require('requestqueue');
 
// Set default maxAttempts and retryDelay for this queue
// Also sets an error handler in case a request exceeds maxAttempts
queue = RequestQueue({ 
    maxAttempts: 5, 
    retryDelay: 1000, 
    errorHandler: function (err) {
        console.error('A request could not be completed:', err.message)
    }
});
 
// Queue a request, the arguments are passed to request-retry module.
queue.push( {
    method: 'GET',
    url: 'http://www.google.com'
    maxAttempts: 3600,
    retryDelay: 1000,
    callback: function (err, response, body) {
        console.log('got response body', body);
    }
} );

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ npm install && npm test

Contribute

Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning.

License

The project is licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i requestqueue

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • balena.io