mirror of https://github.com/actions/toolkit
Fix linting
parent
b9de68a590
commit
80d992795c
|
@ -219,14 +219,13 @@ export class DownloadHttpClient {
|
||||||
fileDownloadPath: string
|
fileDownloadPath: string
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
destinationStream.close()
|
destinationStream.close()
|
||||||
// await until file is created at downloadpath
|
// await until file is created at downloadpath; node15 and up fs.createWriteStream had not created a file yet
|
||||||
// wrap destinationStream's open event in promise
|
|
||||||
await new Promise<void>(resolve => {
|
await new Promise<void>(resolve => {
|
||||||
destinationStream.on('close', resolve)
|
destinationStream.on('close', resolve)
|
||||||
if (destinationStream.writableFinished) {
|
if (destinationStream.writableFinished) {
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
await rmFile(fileDownloadPath)
|
await rmFile(fileDownloadPath)
|
||||||
destinationStream = fs.createWriteStream(fileDownloadPath)
|
destinationStream = fs.createWriteStream(fileDownloadPath)
|
||||||
}
|
}
|
||||||
|
@ -281,8 +280,8 @@ export class DownloadHttpClient {
|
||||||
// if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
|
// if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
|
||||||
isThrottledStatusCode(response.message.statusCode)
|
isThrottledStatusCode(response.message.statusCode)
|
||||||
? await backOff(
|
? await backOff(
|
||||||
tryGetRetryAfterValueTimeInMilliseconds(response.message.headers)
|
tryGetRetryAfterValueTimeInMilliseconds(response.message.headers)
|
||||||
)
|
)
|
||||||
: await backOff()
|
: await backOff()
|
||||||
} else {
|
} else {
|
||||||
// Some unexpected response code, fail immediately and stop the download
|
// Some unexpected response code, fail immediately and stop the download
|
||||||
|
|
Loading…
Reference in New Issue