mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-11-19 02:31:07 +08:00
Hack for timeout for segment download
This commit is contained in:
parent
01e1ff7bc0
commit
9b309c5a32
22
packages/cache/src/internal/downloadUtils.ts
vendored
22
packages/cache/src/internal/downloadUtils.ts
vendored
@ -6,6 +6,7 @@ import * as buffer from 'buffer'
|
||||
import * as fs from 'fs'
|
||||
import * as stream from 'stream'
|
||||
import * as util from 'util'
|
||||
import * as timer from 'timers/promises'
|
||||
|
||||
import * as utils from './cacheUtils'
|
||||
import {SocketTimeout} from './constants'
|
||||
@ -259,14 +260,19 @@ export async function downloadCacheStorageSDK(
|
||||
|
||||
downloadProgress.nextSegment(segmentSize)
|
||||
|
||||
const result = await client.downloadToBuffer(
|
||||
segmentStart,
|
||||
segmentSize,
|
||||
{
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
}
|
||||
)
|
||||
const result = await Promise.Race([client.downloadToBuffer(
|
||||
segmentStart,
|
||||
segmentSize,
|
||||
{
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
}
|
||||
),
|
||||
timer.setTimeout(60 * 60 * 1000, 'timeout')]);
|
||||
|
||||
if(result === 'timeout') {
|
||||
throw new Error("Segment download timed out");
|
||||
}
|
||||
|
||||
fs.writeFileSync(fd, result)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user