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
6 changed files with 16 additions and 12 deletions
+1
View File
@@ -177,6 +177,7 @@ async function runWrapper() {
core.setFailed(`init action failed: ${error}`);
console.log(error);
}
await (0, util_1.checkForTimeout)();
}
void runWrapper();
//# sourceMappingURL=init-action.js.map
File diff suppressed because one or more lines are too long
+3 -3
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
File diff suppressed because one or more lines are too long
+2
View File
@@ -29,6 +29,7 @@ import { parseRepositoryNwo } from "./repository";
import { getTotalCacheSize } from "./trap-caching";
import {
checkActionVersion,
checkForTimeout,
checkGitHubVersionInRange,
codeQlVersionAbove,
DEFAULT_DEBUG_ARTIFACT_NAME,
@@ -332,6 +333,7 @@ async function runWrapper() {
core.setFailed(`init action failed: ${error}`);
console.log(error);
}
await checkForTimeout();
}
void runWrapper();
+8 -7
View File
@@ -113,15 +113,16 @@ export async function downloadTrapCaches(
logger.info(
`Looking in Actions cache for TRAP cache with key ${preferredKey}`
);
const found = await cache.restoreCache(
[cacheDir],
preferredKey,
[
const found = await 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) {