From a09a4413eeb2b6291eeeb2871d0171d8b048a161 Mon Sep 17 00:00:00 2001 From: lofyer Date: Wed, 5 Aug 2026 19:47:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=BE=E5=83=8F=E6=B8=85=E7=90=86?= =?UTF-8?q?=E6=8C=89=E6=95=B4=E6=AF=AB=E7=A7=92=E6=AF=94=E5=AF=B9=20mtime?= =?UTF-8?q?=EF=BC=8CLinux=20=E4=B8=8A=E4=BA=9A=E6=AF=AB=E7=A7=92=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E4=BC=9A=E8=AE=A9=E5=B9=B4=E9=BE=84=E5=8F=98=E8=B4=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/reader/ai-images.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reader/ai-images.js b/src/reader/ai-images.js index 0eaa46f..c406927 100644 --- a/src/reader/ai-images.js +++ b/src/reader/ai-images.js @@ -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++;