mirror of https://github.com/actions/toolkit
Updated cache download to segment download
parent
c202c38407
commit
4b6b45fe18
|
@ -42,3 +42,8 @@ const restoreKeys = [
|
||||||
const cacheKey = await cache.restoreCache(paths, key, restoreKeys)
|
const cacheKey = await cache.restoreCache(paths, key, restoreKeys)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Cache segment restore timeout
|
||||||
|
|
||||||
|
Starting `v3.0.5` of `actions/toolkit`, in case any issue occurs while downloading the cache, the download will be aborted by default within 1 hour if any `segment` doesn't download completely. A `segment` is limited to size of `1GB` for a `32-bit` runner and `2GB` for a `64-bit` runner. So for any cache that exceeds the size of one segment, multiple segments will be downloaded in sequence to complete the download.
|
||||||
|
|
||||||
|
To customise the `segment` download timeout, an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MINS` needs to be set with the timeout minutes. This way the download wouldn't get stuck forever and proceed to next step in the workflow without any problem.
|
||||||
|
|
|
@ -83,4 +83,4 @@
|
||||||
- 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
|
### 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.
|
- Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `CACHE_DOWNLOAD_TIMEOUT_MINS`. Default is 1 hour.
|
|
@ -63,7 +63,7 @@ test('getDownloadOptions overrides download timeout minutes', async () => {
|
||||||
timeoutInMs: 20000,
|
timeoutInMs: 20000,
|
||||||
segmentTimeoutInMs: 3600000
|
segmentTimeoutInMs: 3600000
|
||||||
}
|
}
|
||||||
process.env.CACHE_DOWNLOAD_TIMEOUT_MINS = '10'
|
process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS = '10'
|
||||||
const actualOptions = getDownloadOptions(expectedOptions)
|
const actualOptions = getDownloadOptions(expectedOptions)
|
||||||
|
|
||||||
expect(actualOptions.useAzureSdk).toEqual(expectedOptions.useAzureSdk)
|
expect(actualOptions.useAzureSdk).toEqual(expectedOptions.useAzureSdk)
|
||||||
|
|
|
@ -112,20 +112,21 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions {
|
||||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs
|
result.segmentTimeoutInMs = copy.segmentTimeoutInMs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const customDownloadTimeoutMins = process.env['CACHE_DOWNLOAD_TIMEOUT_MINS']
|
const segmentDownloadTimeoutMins =
|
||||||
|
process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']
|
||||||
|
|
||||||
if (
|
if (
|
||||||
customDownloadTimeoutMins &&
|
segmentDownloadTimeoutMins &&
|
||||||
!isNaN(Number(customDownloadTimeoutMins)) &&
|
!isNaN(Number(segmentDownloadTimeoutMins)) &&
|
||||||
isFinite(Number(customDownloadTimeoutMins))
|
isFinite(Number(segmentDownloadTimeoutMins))
|
||||||
) {
|
) {
|
||||||
result.segmentTimeoutInMs = Number(customDownloadTimeoutMins) * 60 * 1000
|
result.segmentTimeoutInMs = Number(segmentDownloadTimeoutMins) * 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(
|
core.debug(
|
||||||
`Cache download timeout mins env var: ${process.env['CACHE_DOWNLOAD_TIMEOUT_MINS']}`
|
`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`
|
||||||
)
|
)
|
||||||
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`)
|
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue