mirror of
https://github.com/Swatinem/rust-cache
synced 2026-09-07 20:03:24 +00:00
fix: stop cleanup timestamp pruning after the first entry (#377)
The timestamp branch in rmExcept returned after the first directory entry, so at most one outdated item was ever removed. Replace the early return with continue so every entry is checked.
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { f as debug, m as mkdirP, n as create, l as exec, w as which, o as warning, i as info, H as HttpCodes, p as HttpClientError, q as HttpClient, t as isDebug, u as setSecret, B as BearerCredentialHandler, e as error } from './cleanup-BWEbZ6YT.js';
|
||||
import { f as debug, m as mkdirP, n as create, l as exec, w as which, o as warning, i as info, H as HttpCodes, p as HttpClientError, q as HttpClient, t as isDebug, u as setSecret, B as BearerCredentialHandler, e as error } from './cleanup-BPghO_DY.js';
|
||||
import * as path from 'path';
|
||||
import * as crypto from 'crypto';
|
||||
import * as fs from 'fs';
|
||||
+4211
-4211
File diff suppressed because it is too large
Load Diff
+6
-5
@@ -34434,10 +34434,10 @@ async function getCacheProvider() {
|
||||
let cache;
|
||||
switch (cacheProvider) {
|
||||
case "github":
|
||||
cache = await import('./cache-CTfQoCTL.js');
|
||||
cache = await import('./cache-CtywT2QH.js');
|
||||
break;
|
||||
case "warpbuild":
|
||||
cache = await import('./cache-DC26rUaF.js').then(function (n) { return n.c; });
|
||||
cache = await import('./cache-DZhpLd9j.js').then(function (n) { return n.c; });
|
||||
break;
|
||||
default:
|
||||
throw new Error(`The \`cache-provider\` \`${cacheProvider}\` is not valid.`);
|
||||
@@ -35099,8 +35099,9 @@ const ONE_WEEK = 7 * 24 * 3600 * 1000;
|
||||
/**
|
||||
* Removes all files or directories in `dirName` matching some criteria.
|
||||
*
|
||||
* When the `checkTimestamp` flag is set, this will also remove anything older
|
||||
* than one week.
|
||||
* These two modes are mutually exclusive. When the `checkTimestamp` flag is
|
||||
* set, this will remove anything older than one week and `keepPrefix` is
|
||||
* ignored.
|
||||
*
|
||||
* Otherwise, it will remove everything that does not match any string in the
|
||||
* `keepPrefix` set.
|
||||
@@ -35122,7 +35123,7 @@ async function rmExcept(dirName, keepPrefix, checkTimestamp = false) {
|
||||
if (isOutdated) {
|
||||
await rm(dir.path, dirent);
|
||||
}
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
let name = dirent.name;
|
||||
// in Cargo's V1 layout, all packages are suffixed by their hash.
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { e as error, g as getCacheProvider, a as getInput, b as exportVariable, C as CacheConfig, i as info, c as cleanTargetDir, r as reportError, s as setOutput } from './cleanup-BWEbZ6YT.js';
|
||||
import { e as error, g as getCacheProvider, a as getInput, b as exportVariable, C as CacheConfig, i as info, c as cleanTargetDir, r as reportError, s as setOutput } from './cleanup-BPghO_DY.js';
|
||||
import 'os';
|
||||
import 'crypto';
|
||||
import 'fs';
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { e as error, g as getCacheProvider, a as getInput, d as isCacheUpToDate, i as info, C as CacheConfig, c as cleanTargetDir, f as debug, h as cleanRegistry, j as cleanBin, k as cleanGit, r as reportError, l as exec } from './cleanup-BWEbZ6YT.js';
|
||||
import { e as error, g as getCacheProvider, a as getInput, d as isCacheUpToDate, i as info, C as CacheConfig, c as cleanTargetDir, f as debug, h as cleanRegistry, j as cleanBin, k as cleanGit, r as reportError, l as exec } from './cleanup-BPghO_DY.js';
|
||||
import 'os';
|
||||
import 'crypto';
|
||||
import 'fs';
|
||||
|
||||
+4
-3
@@ -243,8 +243,9 @@ const ONE_WEEK = 7 * 24 * 3600 * 1000;
|
||||
/**
|
||||
* Removes all files or directories in `dirName` matching some criteria.
|
||||
*
|
||||
* When the `checkTimestamp` flag is set, this will also remove anything older
|
||||
* than one week.
|
||||
* These two modes are mutually exclusive. When the `checkTimestamp` flag is
|
||||
* set, this will remove anything older than one week and `keepPrefix` is
|
||||
* ignored.
|
||||
*
|
||||
* Otherwise, it will remove everything that does not match any string in the
|
||||
* `keepPrefix` set.
|
||||
@@ -267,7 +268,7 @@ async function rmExcept(dirName: string, keepPrefix: Set<string>, checkTimestamp
|
||||
if (isOutdated) {
|
||||
await rm(dir.path, dirent);
|
||||
}
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
let name = dirent.name;
|
||||
|
||||
Reference in New Issue
Block a user