[object Object]

← back to Ticket System

fix: handle ENOENT gracefully in lock-release path to prevent DM-persist + unlock race (TK-11508)

a8ca813c48026bd6d8d88bb0e86227f85d3a55f1 · 2026-09-12 04:05:25 -0700 · steve@designerwallcoverings.com

Files touched

Diff

commit a8ca813c48026bd6d8d88bb0e86227f85d3a55f1
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date:   Sat Sep 12 04:05:25 2026 -0700

    fix: handle ENOENT gracefully in lock-release path to prevent DM-persist + unlock race (TK-11508)
---
 lib.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib.js b/lib.js
index 2f27c22b..7585503e 100644
--- a/lib.js
+++ b/lib.js
@@ -15,7 +15,7 @@ function withLock(fn) {
   ensure();
   const deadline = Date.now() + 5000;
   for (;;) {
-    try { const fd = fs.openSync(LOCK, 'wx'); try { return fn(); } finally { fs.closeSync(fd); fs.unlinkSync(LOCK); } }
+    try { const fd = fs.openSync(LOCK, 'wx'); try { return fn(); } finally { fs.closeSync(fd); try { fs.unlinkSync(LOCK); } catch (e) { if (e.code !== 'ENOENT') throw e; } } }
     catch (e) {
       if (e.code !== 'EEXIST') throw e;
       // stale lock (>10s old) gets broken

← 1e215079 fix: async /api/skills scan + stale-while-revalidate to prev  ·  back to Ticket System  ·  chore: bump ticket-board to v1.0.1 (nav-bar top strip + posi ab539637 →