TRAP Caching: Re-introduce workaround for download timeout

This commit is contained in:
Edoardo Pirovano 2022-11-16 11:20:47 +00:00
parent c939e6615d
commit bfc56625b0
No known key found for this signature in database
GPG key ID: 047556B5D93FFE28
6 changed files with 16 additions and 12 deletions

6
lib/trap-caching.js generated
View file

@ -100,11 +100,11 @@ async function downloadTrapCaches(codeql, languages, logger) {
// The SHA from the base of the PR is the most similar commit we might have a cache for
const preferredKey = await cacheKey(codeql, language, baseSha);
logger.info(`Looking in Actions cache for TRAP cache with key ${preferredKey}`);
const found = await cache.restoreCache([cacheDir], preferredKey, [
const found = await (0, util_1.withTimeout)(MAX_CACHE_OPERATION_MS, cache.restoreCache([cacheDir], preferredKey, [
// Fall back to any cache with the right key prefix
await cachePrefix(codeql, language),
], {
segmentTimeoutInMs: MAX_CACHE_OPERATION_MS,
]), () => {
logger.info(`Timed out downloading cache for ${language}, will continue without it`);
});
if (found === undefined) {
// We didn't find a TRAP cache in the Actions cache, so the directory on disk is