Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
retry-as-promised
Advanced tools
Readme
Retry promises when they fail, based upon any-promise.
$ npm install --save retry-as-promised
$ yarn add retry-as-promised
var retry = require('retry-as-promised');
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
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'
});
FAQs
Retry a failed promise
The npm package retry-as-promised receives a total of 1,729,795 weekly downloads. As such, retry-as-promised popularity was classified as popular.
We found that retry-as-promised demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.