3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-04-22 11:35:31 +00:00

fix paths for cache dir

This commit is contained in:
Jonathan Kelley 2025-01-28 22:02:28 -08:00
parent b37d2821f8
commit 64b8867183
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
2 changed files with 28 additions and 19 deletions

23
dist/save/index.js vendored
View file

@ -87370,14 +87370,20 @@ async function run() {
// Save the incremental cache before we delete it
if (config.incremental) {
core.info(`... Saving incremental cache ...`);
core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`);
for (const paths of config.incrementalPaths) {
await saveIncrementalDirs(paths);
try {
core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`);
for (const paths of config.incrementalPaths) {
await saveIncrementalDirs(paths);
}
await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey);
for (const path of config.incrementalPaths) {
core.debug(` deleting ${path}`);
await (0,promises_.rm)(path);
}
}
await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey);
for (const path of config.incrementalPaths) {
core.debug(` deleting ${path}`);
await (0,promises_.rm)(path);
catch (e) {
core.debug(`Failed to save incremental cache`);
core.debug(`${e.stack}`);
}
}
const allPackages = [];
@ -87436,9 +87442,8 @@ async function macOsWorkaround() {
}
catch { }
}
async function saveIncrementalDirs(profileDir) {
async function saveIncrementalDirs(incrementalDir) {
// Traverse the incremental folder recursively and collect the modified times in a map
const incrementalDir = external_path_default().join(profileDir, "incremental");
const modifiedTimes = new Map();
const fillModifiedTimes = async (dir) => {
const dirEntries = await external_fs_default().promises.opendir(dir);

View file

@ -42,14 +42,19 @@ async function run() {
// Save the incremental cache before we delete it
if (config.incremental) {
core.info(`... Saving incremental cache ...`);
core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`);
for (const paths of config.incrementalPaths) {
await saveIncrementalDirs(paths);
}
await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey);
for (const path of config.incrementalPaths) {
core.debug(` deleting ${path}`);
await rm(path);
try {
core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`);
for (const paths of config.incrementalPaths) {
await saveIncrementalDirs(paths);
}
await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey);
for (const path of config.incrementalPaths) {
core.debug(` deleting ${path}`);
await rm(path);
}
} catch (e) {
core.debug(`Failed to save incremental cache`);
core.debug(`${(e as any).stack}`);
}
}
@ -112,9 +117,8 @@ async function macOsWorkaround() {
}
async function saveIncrementalDirs(profileDir: string) {
async function saveIncrementalDirs(incrementalDir: string) {
// Traverse the incremental folder recursively and collect the modified times in a map
const incrementalDir = path.join(profileDir, "incremental");
const modifiedTimes = new Map<string, number>();
const fillModifiedTimes = async (dir: string) => {
const dirEntries = await fs.promises.opendir(dir);