mirror of https://github.com/actions/toolkit
Added custom user inputted timeout
parent
63c66cf07e
commit
c202c38407
|
@ -80,4 +80,7 @@
|
||||||
- Added 1 hour timeout for the download stuck issue [#810](https://github.com/actions/cache/issues/810).
|
- Added 1 hour timeout for the download stuck issue [#810](https://github.com/actions/cache/issues/810).
|
||||||
|
|
||||||
### 3.0.3
|
### 3.0.3
|
||||||
- Bug fixes for download stuck issue [#810](https://github.com/actions/cache/issues/810).
|
- Bug fixes for download stuck issue [#810](https://github.com/actions/cache/issues/810).
|
||||||
|
|
||||||
|
### 3.0.4
|
||||||
|
- Allowing users to provide a custom timeout as input for aborting cache download using an environment variable `CACHE_DOWNLOAD_TIMEOUT_MINS`. Default is 1 hour.
|
|
@ -55,3 +55,21 @@ test('getUploadOptions overrides all settings', async () => {
|
||||||
|
|
||||||
expect(actualOptions).toEqual(expectedOptions)
|
expect(actualOptions).toEqual(expectedOptions)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('getDownloadOptions overrides download timeout minutes', async () => {
|
||||||
|
const expectedOptions: DownloadOptions = {
|
||||||
|
useAzureSdk: false,
|
||||||
|
downloadConcurrency: 14,
|
||||||
|
timeoutInMs: 20000,
|
||||||
|
segmentTimeoutInMs: 3600000
|
||||||
|
}
|
||||||
|
process.env.CACHE_DOWNLOAD_TIMEOUT_MINS = '10'
|
||||||
|
const actualOptions = getDownloadOptions(expectedOptions)
|
||||||
|
|
||||||
|
expect(actualOptions.useAzureSdk).toEqual(expectedOptions.useAzureSdk)
|
||||||
|
expect(actualOptions.downloadConcurrency).toEqual(
|
||||||
|
expectedOptions.downloadConcurrency
|
||||||
|
)
|
||||||
|
expect(actualOptions.timeoutInMs).toEqual(expectedOptions.timeoutInMs)
|
||||||
|
expect(actualOptions.segmentTimeoutInMs).toEqual(600000)
|
||||||
|
})
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.0.3",
|
"version": "3.0.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.0.3",
|
"version": "3.0.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.0.3",
|
"version": "3.0.4",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions cache lib",
|
"description": "Actions cache lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -112,10 +112,21 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions {
|
||||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs
|
result.segmentTimeoutInMs = copy.segmentTimeoutInMs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const customDownloadTimeoutMins = process.env['CACHE_DOWNLOAD_TIMEOUT_MINS']
|
||||||
|
|
||||||
|
if (
|
||||||
|
customDownloadTimeoutMins &&
|
||||||
|
!isNaN(Number(customDownloadTimeoutMins)) &&
|
||||||
|
isFinite(Number(customDownloadTimeoutMins))
|
||||||
|
) {
|
||||||
|
result.segmentTimeoutInMs = Number(customDownloadTimeoutMins) * 60 * 1000
|
||||||
|
}
|
||||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`)
|
core.debug(`Use Azure SDK: ${result.useAzureSdk}`)
|
||||||
core.debug(`Download concurrency: ${result.downloadConcurrency}`)
|
core.debug(`Download concurrency: ${result.downloadConcurrency}`)
|
||||||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`)
|
core.debug(`Request timeout (ms): ${result.timeoutInMs}`)
|
||||||
|
core.debug(
|
||||||
|
`Cache download timeout mins env var: ${process.env['CACHE_DOWNLOAD_TIMEOUT_MINS']}`
|
||||||
|
)
|
||||||
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`)
|
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue