Installations
npm install async-retry
Score
98.3
Supply Chain
79.7
Quality
81.9
Maintenance
100
Vulnerability
100
License
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
14.16.0
NPM Version
6.14.11
Statistics
1,850 Stars
116 Commits
53 Forks
54 Watching
7 Branches
80 Contributors
Updated on 20 Nov 2024
Bundle Size
3.94 kB
Minified
1.41 kB
Minified + Gzipped
Languages
JavaScript (93.3%)
Dockerfile (6.7%)
Total Downloads
Cumulative downloads
Total Downloads
1,102,512,583
Last day
-15.8%
1,556,617
Compared to previous day
Last week
2.3%
9,675,066
Compared to previous week
Last month
8.7%
40,175,771
Compared to previous month
Last year
27.4%
361,895,856
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
async-retry
Retrying made simple, easy, and async.
Usage
1// Packages 2const retry = require('async-retry'); 3const fetch = require('node-fetch'); 4 5await retry( 6 async (bail) => { 7 // if anything throws, we retry 8 const res = await fetch('https://google.com'); 9 10 if (403 === res.status) { 11 // don't retry upon 403 12 bail(new Error('Unauthorized')); 13 return; 14 } 15 16 const data = await res.text(); 17 return data.substr(0, 500); 18 }, 19 { 20 retries: 5, 21 } 22);
API
1retry(retrier : Function, opts : Object) => Promise
- The supplied function can be
async
or not. In other words, it can be a function that returns aPromise
or a value. - The supplied function receives two parameters
- A
Function
you can invoke to abort the retrying (bail) - A
Number
identifying the attempt. The absolute first attempt (before any retries) is1
.
- A
- The
opts
are passed tonode-retry
. Read its docsretries
: The maximum amount of times to retry the operation. Default is10
.factor
: The exponential factor to use. Default is2
.minTimeout
: The number of milliseconds before starting the first retry. Default is1000
.maxTimeout
: The maximum number of milliseconds between two retries. Default isInfinity
.randomize
: Randomizes the timeouts by multiplying with a factor between1
to2
. Default istrue
.onRetry
: an optionalFunction
that is invoked after a new retry is performed. It's passed theError
that triggered it as a parameter.
Authors
- Guillermo Rauch (@rauchg) - Vercel
- Leo Lamprecht (@notquiteleo) - Vercel
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/vercel/.github/SECURITY.md:1
- Info: Found linked content: github.com/vercel/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/vercel/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/vercel/.github/SECURITY.md:1
Reason
Found 8/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/async-retry/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/async-retry/ci.yml/main?enable=pin
- Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating mhart/alpine-node:10.7.0 to mhart/alpine-node:10.7.0@sha256:fc5dfe8af093948a8f48b018db5addae767c383c8d3430bcd131e371406bfde5
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:20
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 11 are checked with a SAST tool
Reason
13 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
3.3
/10
Last Scanned on 2024-11-18
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