mirror of https://github.com/actions/toolkit
lint and format
parent
ecb4df89bf
commit
ff2c524611
|
@ -17,7 +17,6 @@ import {
|
||||||
} from '../../generated'
|
} from '../../generated'
|
||||||
import {getBackendIdsFromToken} from '../shared/util'
|
import {getBackendIdsFromToken} from '../shared/util'
|
||||||
import {ArtifactNotFoundError} from '../shared/errors'
|
import {ArtifactNotFoundError} from '../shared/errors'
|
||||||
import { clear } from 'console'
|
|
||||||
|
|
||||||
const scrubQueryParameters = (url: string): string => {
|
const scrubQueryParameters = (url: string): string => {
|
||||||
const parsed = new URL(url)
|
const parsed = new URL(url)
|
||||||
|
@ -47,7 +46,9 @@ async function streamExtract(url: string, directory: string): Promise<void> {
|
||||||
return
|
return
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
retryCount++
|
retryCount++
|
||||||
core.warning(`Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`)
|
core.warning(
|
||||||
|
`Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`
|
||||||
|
)
|
||||||
// wait 5 seconds before retrying
|
// wait 5 seconds before retrying
|
||||||
await new Promise(resolve => setTimeout(resolve, 5000))
|
await new Promise(resolve => setTimeout(resolve, 5000))
|
||||||
}
|
}
|
||||||
|
@ -56,7 +57,10 @@ async function streamExtract(url: string, directory: string): Promise<void> {
|
||||||
throw new Error(`Artifact download failed after ${retryCount} retries.`)
|
throw new Error(`Artifact download failed after ${retryCount} retries.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function streamExtractInternal(url: string,directory: string): Promise<void> {
|
async function streamExtractInternal(
|
||||||
|
url: string,
|
||||||
|
directory: string
|
||||||
|
): Promise<void> {
|
||||||
const client = new httpClient.HttpClient(getUserAgentString())
|
const client = new httpClient.HttpClient(getUserAgentString())
|
||||||
const response = await client.get(url)
|
const response = await client.get(url)
|
||||||
|
|
||||||
|
@ -71,17 +75,21 @@ async function streamExtractInternal(url: string,directory: string): Promise<voi
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timerFn = (): void => {
|
const timerFn = (): void => {
|
||||||
// close response stream
|
// close response stream
|
||||||
core.warning("timerFn: closing response stream")
|
core.warning('timerFn: closing response stream')
|
||||||
response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`))
|
response.message.destroy(
|
||||||
|
new Error(`Blob storage chunk did not respond in ${timeout}ms`)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
let timer = setTimeout(timerFn, timeout)
|
const timer = setTimeout(timerFn, timeout)
|
||||||
|
|
||||||
response.message
|
response.message
|
||||||
.on('data', () => {
|
.on('data', () => {
|
||||||
timer.refresh()
|
timer.refresh()
|
||||||
})
|
})
|
||||||
.on('error', (error: Error) => {
|
.on('error', (error: Error) => {
|
||||||
core.warning(`response.message: Artifact download failed: ${error.message}`)
|
core.warning(
|
||||||
|
`response.message: Artifact download failed: ${error.message}`
|
||||||
|
)
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue