Skip to content

Commit

Permalink
[ci] adjust retry when downloading form jspm
Browse files Browse the repository at this point in the history
  • Loading branch information
hgw77 committed Nov 2, 2023
1 parent 317076c commit 72d4969
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ci/scripts/generate_importmap.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const installPackage = async (name) => {
* @param {string} path
* @returns void
*/
const downloadFile = (url, path, maxRetries = 5, currentRetry = 0) => {
const downloadFile = (url, path, maxRetries = 10, currentRetry = 0) => {
return new Promise((resolve, reject) => {
fs.mkdirSync(pathLib.dirname(path), { recursive: true })
const file = fs.createWriteStream(path)
Expand All @@ -263,12 +263,13 @@ const downloadFile = (url, path, maxRetries = 5, currentRetry = 0) => {
// Retry after a delay (you can adjust the delay as needed)
setTimeout(() => {
resolve(downloadFile(url, path, maxRetries, currentRetry + 1))
}, 1000) // 1000 milliseconds (1 second) delay in this example
}, 2000) // 1000 milliseconds (1 second) delay in this example
} else {
// Maximum retries reached, reject the promise
reject(
console.error(
`[generate_importmap]::downloadFile: max retries (${maxRetries}) reached. Error: ${error.message}`
)
reject(error)
}
})

Expand Down

0 comments on commit 72d4969

Please sign in to comment.