mirror of https://github.com/actions/toolkit
adds custom timeout
parent
7efbd158ad
commit
a36bdbabae
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "github-actions.warp-cache",
|
"name": "github-actions.warp-cache",
|
||||||
"version": "1.1.10",
|
"version": "1.1.11",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Github action to use WarpBuild's in-house cache offering",
|
"description": "Github action to use WarpBuild's in-house cache offering",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -254,8 +254,7 @@ export async function downloadCacheSingleThread(
|
||||||
retryOptions: {
|
retryOptions: {
|
||||||
autoRetry: false,
|
autoRetry: false,
|
||||||
maxRetries: 1
|
maxRetries: 1
|
||||||
},
|
}
|
||||||
timeout: 300
|
|
||||||
})
|
})
|
||||||
await downloadCacheGCP(storage, archiveLocation, archivePath)
|
await downloadCacheGCP(storage, archiveLocation, archivePath)
|
||||||
break
|
break
|
||||||
|
|
|
@ -327,13 +327,32 @@ export async function downloadCacheGCP(
|
||||||
archivePath: string
|
archivePath: string
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
const timeoutDuration = 300000 // 5 minutes
|
||||||
|
|
||||||
|
const timeoutPromise = new Promise((_, reject) =>
|
||||||
|
setTimeout(() => reject(new Error('Download timed out')), timeoutDuration)
|
||||||
|
)
|
||||||
|
|
||||||
const {bucketName, objectName} =
|
const {bucketName, objectName} =
|
||||||
utils.retrieveGCSBucketAndObjectName(archiveLocation)
|
utils.retrieveGCSBucketAndObjectName(archiveLocation)
|
||||||
|
|
||||||
await storage.bucket(bucketName).file(objectName).download({
|
const downloadPromise = storage
|
||||||
|
.bucket(bucketName)
|
||||||
|
.file(objectName)
|
||||||
|
.download({
|
||||||
destination: archivePath,
|
destination: archivePath,
|
||||||
validation: 'crc32c'
|
validation: 'crc32c'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
await Promise.race([downloadPromise, timeoutPromise])
|
||||||
|
core.debug(
|
||||||
|
`Download completed for bucket: ${bucketName}, object: ${objectName}`
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
core.debug(`Failed to download cache: ${error}`)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.debug(`Failed to download cache: ${error}`)
|
core.debug(`Failed to download cache: ${error}`)
|
||||||
throw error
|
throw error
|
||||||
|
|
Loading…
Reference in New Issue