Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
promise-cache-retry
Advanced tools
[![NPM Version][npm-image]][npm-url] [![license][license-image]][license-url] [![GitHub Actions][github-image]][github-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![TypeScript Style Guide][gts-image]][gts-url] [![standard-readme compliant](http
If you simply cache the Promise it will always resolve with an error after an error occurs. On the other hand, retrying within a Promise will leave the Promise unresolved until the error is resolved, blocking further processing.
So this library works like this: If an error occurs, resolve it as an error, automatically perform retry processing (unless you disable it explicitly), and return the retry result when referencing the cache.
npm install --save promise-cache-retry
import { PromiseCache } from 'promise-cache-retry';
const cache = new PromiseCache({
promiseGenerator: async () => {
const res = await fetchData(ENDPOINT);
return res.data;
},
options: {
maxRetries: 2,
minRetryInterval: 3000,
},
});
export const handler = async () => {
const value = await cache.get();
}
PRs accepted.
Small note: If editing the Readme, please conform to the standard-readme specification.
FAQs
[![NPM Version][npm-image]][npm-url] [![license][license-image]][license-url] [![GitHub Actions][github-image]][github-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![TypeScript Style Guide][gts-image]][gts-url] [![standard-readme compliant](http
The npm package promise-cache-retry receives a total of 3 weekly downloads. As such, promise-cache-retry popularity was classified as not popular.
We found that promise-cache-retry 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.