3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-08-24 21:56:03 +00:00

Discard files older than 3 days from cache

This commit is contained in:
Alexander van Saase 2025-03-11 12:54:37 +01:00
parent 3abbfe0f3f
commit 2f124887c3
4 changed files with 8 additions and 8 deletions

View file

@ -87258,7 +87258,7 @@ async function cleanGit(packages) {
}
catch { }
}
const ONE_WEEK = 7 * 24 * 3600 * 1000;
const THREE_DAYS = 3 * 24 * 3600 * 1000;
/**
* Removes all files or directories in `dirName` matching some criteria.
*
@ -87275,7 +87275,7 @@ async function rmExcept(dirName, keepPrefix, checkTimestamp = false) {
if (checkTimestamp) {
const fileName = external_path_default().join(dir.path, dirent.name);
const { mtime } = await external_fs_default().promises.stat(fileName);
const isOutdated = Date.now() - mtime.getTime() > ONE_WEEK;
const isOutdated = Date.now() - mtime.getTime() > THREE_DAYS;
if (isOutdated) {
await rm(dir.path, dirent);
}