mirror of
https://github.com/github/codeql-action.git
synced 2026-10-29 17:17:15 +00:00
Front-load caching and rear-load saving to disk
This implementation saves CPU and I/O by not trying to write to the file on every set-cache.
This commit is contained in:
13
lib/entry-points.js
generated
13
lib/entry-points.js
generated
@@ -149934,9 +149934,12 @@ function readCommandCacheFile() {
|
||||
}
|
||||
return {};
|
||||
}
|
||||
function writeCommandCacheFile(data) {
|
||||
function writeCommandCacheFile() {
|
||||
try {
|
||||
fs6.writeFileSync(getCommandCacheFilePath(), JSON.stringify(data));
|
||||
fs6.writeFileSync(
|
||||
getCommandCacheFilePath(),
|
||||
JSON.stringify(Object.fromEntries(inMemoryCache))
|
||||
);
|
||||
} catch (e) {
|
||||
logger.warning(`Failed to write command cache file: ${e}`);
|
||||
}
|
||||
@@ -149944,9 +149947,6 @@ function writeCommandCacheFile(data) {
|
||||
function cacheCommandOutput(key, cmd, output) {
|
||||
const entry = { cmd, output };
|
||||
inMemoryCache.set(key, entry);
|
||||
const data = readCommandCacheFile();
|
||||
data[key] = entry;
|
||||
writeCommandCacheFile(data);
|
||||
}
|
||||
function getCachedCommandOutput(key, cmd, validate) {
|
||||
const memoized = inMemoryCache.get(key);
|
||||
@@ -159013,6 +159013,8 @@ async function run3(startedAt) {
|
||||
toolsVersion = initCodeQLResult.toolsVersion;
|
||||
toolsSource = initCodeQLResult.toolsSource;
|
||||
zstdAvailability = initCodeQLResult.zstdAvailability;
|
||||
await codeql.getVersion();
|
||||
await codeql.resolveLanguages();
|
||||
await checkWorkflow(logger2, codeql);
|
||||
if (
|
||||
// Only enable the experimental features env variable for Rust analysis if the user has explicitly
|
||||
@@ -159322,6 +159324,7 @@ exec ${goBinaryPath} "$@"`
|
||||
await saveConfig(config, logger2);
|
||||
core20.setOutput("codeql-path", config.codeQLCmd);
|
||||
core20.setOutput("codeql-version", (await codeql.getVersion()).version);
|
||||
writeCommandCacheFile();
|
||||
} catch (unwrappedError) {
|
||||
const error3 = wrapError(unwrappedError);
|
||||
core20.setFailed(error3.message);
|
||||
|
||||
Reference in New Issue
Block a user