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