needle-retry
Make needle retry automatically on failed requests.
Last updated 4 years ago by alexlangberg .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install needle-retry 
SYNC missed versions from official npm registry.

needle-retry

npm version Build Status Dependency Status devDependency Status

Combines needle with retry to account for unstable webservers. Thus, needle-retry will retry for a certain number of times (default 5) before giving up. Currently implements request and get. Tests currently only cover GET requests but everything should work too, as this is basically just a wrapper.

Installation

npm install needle-retry

Options

Options can be passed in as the second parameter, as an object with a property needle for needle options and a property retry for retry options. This module has a single option, fullDocument that will make it retry if a full HTML document is not received. Defaults to false. Default options:

var options = {
    needleRetry: {
        fullDocument: false
    },
    needle: {
        follow_max: 20
    },
    retry: {
        retries: 5
    }
}

Have a look at the respective doc pages for needle and retry for a list of available options.

Example

var needle = require('needle-retry');

needle.get('http://www.github.com', function(error, response) {
  console.log(response.body);
});

Example request

var needle = require('needle-retry');

var options = {
    needleRetry: {
        fullDocument: false
    },
    needle: {
        follow_max: 20
    },
    retry: {
        retries: 5
    }
}

var data = {
    foo: 'bar'
}

needle.request('get', 'http://www.github.com', data, options, function(error, response) {
  console.log(response.body);
});

Current Tags

  • 1.1.2                                ...           latest (4 years ago)

5 Versions

  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (7)

Copyright 2014 - 2016 © taobao.org |