Skip to content

Commit 84ecfb4

Browse files
committed
fix: retry tool download process in case of errors
1 parent 17b183c commit 84ecfb4

File tree

7 files changed

+20
-6
lines changed

7 files changed

+20
-6
lines changed

dist/node12/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node12/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"path-exists": "^4.0.0",
7070
"patha": "^0.4.1",
7171
"quote-unquote": "^1.0.0",
72+
"retry-as-promised": "^7.0.3",
7273
"semver": "7.3.8",
7374
"setup-python": "github:actions/setup-python#v4.3.1",
7475
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",

pnpm-lock.yaml

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/setup/setupBin.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { hasDnf } from "../env/hasDnf"
1212
import { setupDnfPack } from "./setupDnfPack"
1313
import { isUbuntu } from "../env/isUbuntu"
1414
import pathExists from "path-exists"
15+
import retry from "retry-as-promised"
1516

1617
/** A type that describes a package */
1718
export type PackageInfo = {
@@ -91,7 +92,13 @@ export async function setupBin(
9192
if ((await Promise.all([pathExists(binDir), pathExists(binFile)])).includes(false)) {
9293
try {
9394
info(`Download ${name} ${version}`)
94-
const downloaded = await downloadTool(url)
95+
// try to download the package 4 times with 2 seconds delay
96+
const downloaded = await retry(
97+
() => {
98+
return downloadTool(url)
99+
},
100+
{ max: 4, backoffBase: 2000, report: (err) => info(err) }
101+
)
95102

96103
if (!didInit) {
97104
info(`Installing extraction dependencies`)

0 commit comments

Comments
 (0)