Gathering detailed insights and metrics for @pdedg/promise-retry
Gathering detailed insights and metrics for @pdedg/promise-retry
Gathering detailed insights and metrics for @pdedg/promise-retry
Gathering detailed insights and metrics for @pdedg/promise-retry
npm install @pdedg/promise-retry
Typescript
Module System
Node Version
NPM Version
70.9
Supply Chain
99.3
Quality
75.3
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
9 Commits
5 Branches
1 Contributors
Updated on Aug 14, 2019
Latest Version
1.0.6
Package Id
@pdedg/promise-retry@1.0.6
Unpacked Size
32.66 kB
Size
10.17 kB
File Count
17
NPM Version
5.4.2
Node Version
8.9.4
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
promise-retry A promise retry executor with exponential backoff strategy. Comes with fetch retry out of the box
Install the package:
1npm i @pdedg/promise-retry
A promise retry executor
1// Simple execution 2 3import { promiseRetry } from '@pdedg/promise-retry'; 4 5const run = () => new Promise((resolve, reject) => reject()); 6promiseRetry(run); // will execute rejected promise by default 3 times and after will trow error
1// With custom delay strategy 2 3import { promiseRetry } from '@pdedg/promise-retry'; 4 5const options = { 6 retries: 5, 7 retryOn: (err) => true, 8 delay: (err) => err.attempt * 1000, 9 onFailedAttempt: (err) => console.log(err.status) 10} 11 12const run = () => new Promise((resolve, reject) => reject()); 13promiseRetry(run); 14/* 15 Will result of: 5 executions of failed promise ( retryOn is set to all ways true ). 16 On each attempt it will execute the onFailedAttempt, and will use linear delay between executions ( last will be 5s delay ) 17 */
Wraps a fetch request with retry, by default it will retry on the following http status [408, 503, 504] and on request-timeout error.
1// Simple execution 2 3import { fetchRetry } from '@pdedg/promise-retry'; 4 5const fetch = () => new Promise((resolve, reject) => reject()); 6fetchRetry(fetch, '/end-point', { delay: 100 }); // Will execute 3 fetch calls with 100 / 200 / 400 delay and eventually an error will be thrown.
1// With custom options 2 3import { fetchRetry } from '@pdedg/promise-retry'; 4 5const options = { 6 retries: 2, 7 retryOnResolved: (res) => { 8 if (res.status === 300) { 9 throw new Error('Cannot handle 300 status.') 10 } 11 }, 12} 13 14const fetch = () => new Promise((resolve, reject) => resolve({ status: 300 })); 15fetchRetry(fetch, '/end-point', options) 16/* 17 Will result of: 2 executions of resolved promises, that will be rejected by the validate resolved method. 18 eventually, it will throw an error. 19 */
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
71 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More