@@ -5473,6 +5473,7 @@ const util = __importStar(__webpack_require__(669));
54735473const utils = __importStar(__webpack_require__(15));
54745474const constants_1 = __webpack_require__(931);
54755475const requestUtils_1 = __webpack_require__(899);
5476+ const abort_controller_1 = __webpack_require__(106);
54765477/**
54775478 * Pipes the body of a HTTP response to a stream
54785479 *
@@ -5656,11 +5657,16 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
56565657 const fd = fs.openSync(archivePath, 'w');
56575658 try {
56585659 downloadProgress.startDisplayTimer();
5660+ const abortSignal = abort_controller_1.AbortController.timeout(options.segmentTimeoutInMs || 3600000);
5661+ abortSignal.addEventListener('abort', () => {
5662+ core.warning('Aborting cache download as it exceeded the timeout.');
5663+ });
56595664 while (!downloadProgress.isDone()) {
56605665 const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
56615666 const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
56625667 downloadProgress.nextSegment(segmentSize);
56635668 const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
5669+ abortSignal,
56645670 concurrency: options.downloadConcurrency,
56655671 onProgress: downloadProgress.onProgress()
56665672 });
@@ -40795,7 +40801,8 @@ function getDownloadOptions(copy) {
4079540801 const result = {
4079640802 useAzureSdk: true,
4079740803 downloadConcurrency: 8,
40798- timeoutInMs: 30000
40804+ timeoutInMs: 30000,
40805+ segmentTimeoutInMs: 3600000
4079940806 };
4080040807 if (copy) {
4080140808 if (typeof copy.useAzureSdk === 'boolean') {
@@ -40807,10 +40814,14 @@ function getDownloadOptions(copy) {
4080740814 if (typeof copy.timeoutInMs === 'number') {
4080840815 result.timeoutInMs = copy.timeoutInMs;
4080940816 }
40817+ if (typeof copy.segmentTimeoutInMs === 'number') {
40818+ result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
40819+ }
4081040820 }
4081140821 core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
4081240822 core.debug(`Download concurrency: ${result.downloadConcurrency}`);
4081340823 core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
40824+ core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
4081440825 return result;
4081540826}
4081640827exports.getDownloadOptions = getDownloadOptions;
0 commit comments