mirror of https://github.com/actions/toolkit
update to http client
parent
d6f3ee93b8
commit
c33724abbd
|
@ -39,13 +39,15 @@ async function exists(path: string): Promise<boolean> {
|
||||||
|
|
||||||
async function streamExtract(url: string, directory: string): Promise<void> {
|
async function streamExtract(url: string, directory: string): Promise<void> {
|
||||||
let retryCount = 0
|
let retryCount = 0
|
||||||
while (retryCount < 3) {
|
while (retryCount < 5) {
|
||||||
try {
|
try {
|
||||||
await streamExtractInternal(url, directory)
|
await streamExtractInternal(url, directory)
|
||||||
return
|
return
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
retryCount++
|
retryCount++
|
||||||
core.warning(`Failed to download artifact. Retrying...`)
|
core.warning(`Failed to download artifact. Retrying in 5 seconds...`)
|
||||||
|
// wait 5 seconds before retrying
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 5000))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +72,7 @@ async function streamExtractInternal(
|
||||||
|
|
||||||
const timeout = 30 * 1000
|
const timeout = 30 * 1000
|
||||||
const timerFn = (): void => {
|
const timerFn = (): void => {
|
||||||
|
zipStream.end()
|
||||||
reject(new Error(`Blob storage chunk did not respond in ${timeout}ms `))
|
reject(new Error(`Blob storage chunk did not respond in ${timeout}ms `))
|
||||||
}
|
}
|
||||||
let timer = setTimeout(timerFn, timeout)
|
let timer = setTimeout(timerFn, timeout)
|
||||||
|
@ -82,6 +85,7 @@ async function streamExtractInternal(
|
||||||
})
|
})
|
||||||
.pipe(zipStream)
|
.pipe(zipStream)
|
||||||
.on('close', () => {
|
.on('close', () => {
|
||||||
|
core.debug(`zip stream: Artifact downloaded to: ${directory}`)
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue