Skip to content

Commit

Permalink
fix: fix definition of retry-times
Browse files Browse the repository at this point in the history
  • Loading branch information
outloudvi committed May 12, 2023
1 parent a85d7d4 commit 4d12591
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6854,12 +6854,14 @@ const FetchFailure = Symbol("FetchFailure");

async function tryFetch(url, retryTimes) {
let result;
for (let i = 1; i <= retryTimes; i++) {
for (let i = 0; i <= retryTimes; i++) {
result = await fetch(url)
.then((x) => x.buffer())
.catch((err) => {
console.error(
`[${i}/${retryTimes}] Fail to download file ${url}: ${err}`
`${
i === 0 ? "" : `[Retry ${i}/${retryTimes}]`
}Fail to download file ${url}: ${err}`
);
if (i === retryTimes) {
core.setFailed(`Fail to download file ${url}: ${err}`);
Expand Down
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ const FetchFailure = Symbol("FetchFailure");

async function tryFetch(url, retryTimes) {
let result;
for (let i = 1; i <= retryTimes; i++) {
for (let i = 0; i <= retryTimes; i++) {
result = await fetch(url)
.then((x) => x.buffer())
.catch((err) => {
console.error(
`[${i}/${retryTimes}] Fail to download file ${url}: ${err}`
`${
i === 0 ? "" : `[Retry ${i}/${retryTimes}]`
}Fail to download file ${url}: ${err}`
);
if (i === retryTimes) {
core.setFailed(`Fail to download file ${url}: ${err}`);
Expand Down

0 comments on commit 4d12591

Please sign in to comment.