Use common getTotalCacheSize for TRAP caching

This commit is contained in:
Michael B. Gale 2024-10-29 11:52:15 +00:00
parent 0cb71294e5
commit 21e6a62b15
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
9 changed files with 9 additions and 28 deletions

5
lib/trap-caching.js generated
View file

@ -27,7 +27,6 @@ exports.downloadTrapCaches = downloadTrapCaches;
exports.uploadTrapCaches = uploadTrapCaches;
exports.cleanupTrapCaches = cleanupTrapCaches;
exports.getLanguagesSupportingCaching = getLanguagesSupportingCaching;
exports.getTotalCacheSize = getTotalCacheSize;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const actionsCache = __importStar(require("@actions/cache"));
@ -227,10 +226,6 @@ async function getLanguagesSupportingCaching(codeql, languages, logger) {
}
return result;
}
async function getTotalCacheSize(trapCaches, logger) {
const sizes = await Promise.all(Object.values(trapCaches).map((cacheDir) => (0, util_1.tryGetFolderBytes)(cacheDir, logger)));
return sizes.map((a) => a || 0).reduce((a, b) => a + b, 0);
}
async function cacheKey(codeql, language, baseSha) {
return `${await cachePrefix(codeql, language)}${baseSha}`;
}