fix: 图像清理按整毫秒比对 mtime,Linux 上亚毫秒精度会让年龄变负
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
This commit is contained in:
@@ -125,7 +125,9 @@ function cleanup(referencedIds, options) {
|
||||
let removed = 0;
|
||||
for (const blob of listBlobs()) {
|
||||
if (keep.has(blob.imageId)) continue;
|
||||
if (now - blob.mtimeMs < graceMs) continue;
|
||||
// mtimeMs 在 ext4/APFS 上带亚毫秒小数,而 Date.now() 只到整毫秒,
|
||||
// 刚落盘的文件算出来的年龄会是负数,graceMs 为 0 时也永远删不掉
|
||||
if (now - Math.floor(blob.mtimeMs) < graceMs) continue;
|
||||
try {
|
||||
fs.unlinkSync(blob.file);
|
||||
removed++;
|
||||
|
||||
Reference in New Issue
Block a user