
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A Promise version of async/retry. Also includes serveral WaitStrategies that might be useful for situations where more well-behaved service polling is preferred.
Thanks to Caolan McMahon for the great work!
npm install retryit --save
opts: Object | number
{ times: 5, interval: 0, errorFilter: () => true }opts can be either an object or a number.times - The number of attempts to make before giving up. The default is 5.interval - The time to wait between retries, in milliseconds. The default is 0. The interval may also be specified as a function of the retry count (see example). This library provides serveral wait strategies that you can use it as interval.errorFilter - An optional synchronous function that is invoked on erroneous result. If it returns true the retry attempts will continue; if the function returns false the retry flow is aborted with the current attempt's error and result being returned to the final callback. Invoked with (err).opts is a number, the number specifies the number of times to retry, with the default interval of 0.task: function(err)
import retryit from 'retyryit';
// The `retry` function can be used as a stand-alone control flow by passing
// a callback, as shown below:
// try calling getPromise 3 times
retryit(3, (err) => {
if (err) {
// err is previous error
console.error(err);
}
// return a Promise
})
.then(result => {
// do something with the result
})
.catch(err => {
// do something with the error
});
// try calling getPromise 3 times, waiting 200 ms between each retry
retryit({ times: 3, interval: 200 }, getPromise)
.then(result => {
// do something with the result
})
.catch(err => {
// do something with the error
});
retryit({
times: 10,
interval: (retryCount) => {
return 50 * Math.pow(2, retryCount);
}
}, getPromise)
.then(result => {
// do something with the result
})
.catch(err => {
// do something with the error
});
// try calling getPromise the default 5 times no delay between each retry
retryit(getPromise)
.then(result => {
// do something with the result
})
.catch(err => {
// do something with the error
});
// try calling getPromise only when error condition satisfies, all other
// errors will abort the retry control flow and return to final callback
retryit({
errorFilter: function(err) {
return err.message === 'Temporary error'; // only retry on a specific error
}
}, getPromise)
.then(result => {
// do something with the result
})
.catch(err => {
// do something with the error
});
Inspired by guava-retrying
fixedWait(interval = 0)exponentialWait(multiplier = 1, max = Number.MAX_VALUE)fibonacciWait(multiplier = 1, max = Number.MAX_VALUE)incrementingWait(initialSleepTime = 0, increment = 1000, max = Number.MAX_VALUE)randomWait(min = 0, max = 0)import retryit, { exponentialWait } from 'retryit';
retryit({
times: 10,
interval: exponentialWait(2, 64),
}, getPromise)
.then(result => {
// do something with the result
})
.catch(err => {
// do something with the error
});
MIT
FAQs
A Promise version of async/retry
We found that retryit 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.