зеркало из https://github.com/electron/electron.git
ci: add retries to downloads for arm testing (#18526)
This commit is contained in:
Родитель
1e3e5a6619
Коммит
a31faaae61
|
@ -49,9 +49,28 @@ async function downloadArtifact (name, buildNum, dest) {
|
|||
process.exit(1)
|
||||
} else {
|
||||
console.log(`Downloading ${artifactToDownload.url}.`)
|
||||
await downloadFile(artifactToDownload.url, dest)
|
||||
let downloadError = false
|
||||
await downloadWithRetry(artifactToDownload.url, dest).catch(err => {
|
||||
console.log(`Error downnloading ${artifactToDownload.url} :`, err)
|
||||
downloadError = true
|
||||
})
|
||||
if (!downloadError) {
|
||||
console.log(`Successfully downloaded ${name}.`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadWithRetry (url, directory) {
|
||||
let lastError
|
||||
for (let i = 0; i < 5; i++) {
|
||||
console.log(`Attempting to download ${url} - attempt #${(i + 1)}`)
|
||||
try {
|
||||
return await downloadFile(url, directory)
|
||||
} catch (err) {
|
||||
lastError = err
|
||||
}
|
||||
}
|
||||
throw lastError
|
||||
}
|
||||
|
||||
function downloadFile (url, directory) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче