mirror of https://github.com/actions/toolkit
Hack for timeout for segment download
parent
01e1ff7bc0
commit
9b309c5a32
|
@ -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…
Reference in New Issue