7.1.1 • Published 1 year ago
retry-as-promised v7.1.1
retry-as-promised
Retry promises when they fail
Installation
$ npm install --save retry-as-promised
$ yarn add retry-as-promisedConfiguration
var retry = require('retry-as-promised').default;
var warningFn = function(msg){ someLoggingFunction(msg, 'notice'); };
// Will call the until max retries or the promise is resolved.
return retry(function (options) {
// options.current, times callback has been called including this call
return promise;
}, {
max: 3, // maximum amount of tries
timeout: 10000 // throw if no response or error within millisecond timeout, default: undefined,
match: [ // Must match error signature (ala bluebird catch) to continue
Sequelize.ConnectionError,
'SQLITE_BUSY'
],
backoffBase: 1000 // Initial backoff duration in ms. Default: 100,
backoffExponent: 1.5 // Exponent to increase backoff each try. Default: 1.1
backoffJitter: 150 // Amount of randomized jitter in ms to add to retry interval to spread retries out over time. Default: 0.0.
report: warningFn, // the function used for reporting; must have a (string, object) argument signature, where string is the message that will passed in by retry-as-promised, and the object will be this configuration object + the $current property
name: 'SourceX' // if user supplies string, it will be used when composing error/reporting messages; else if retry gets a callback, uses callback name in erroring/reporting; else (default) uses literal string 'unknown'
});Tested with
- Bluebird
- Q
7.1.1
1 year ago
7.1.0
1 year ago
7.0.4
3 years ago
7.0.0
3 years ago
7.0.3
3 years ago
7.0.2
3 years ago
7.0.1
3 years ago
6.1.0
4 years ago
6.0.0
4 years ago
5.0.0
4 years ago
4.0.0
5 years ago
3.2.0
7 years ago
3.1.0
8 years ago
3.0.0
8 years ago
2.3.2
9 years ago
2.3.1
9 years ago
2.3.0
9 years ago
2.2.0
10 years ago
2.1.0
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago
1.1.0
11 years ago
1.0.1
11 years ago
1.0.0
11 years ago
0.0.1
11 years ago