From e2ed40da61c20430c4c21f0b81a95ac41fffd727 Mon Sep 17 00:00:00 2001 From: l1s5 Date: Sun, 25 Oct 2026 03:00:07 +0900 Subject: [PATCH] heatsync: do not hot reload on ctime-only changes `fs.watchFile()` calls its listener on all changes to any file attribute, including `ctime`. Hardlinking a file changes its `ctime`, which is what `nix store optimize` does when it deduplicates identical files, causing an unnecessary reload in production environments. This change makes it so we completely ignore ctime changes, and only reload when mtime/size changes. --- start.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/start.js b/start.js index eb84627..58c7a46 100755 --- a/start.js +++ b/start.js @@ -13,7 +13,11 @@ const {reg} = require("./src/matrix/read-registration") const passthrough = require("./src/passthrough") const db = new sqlite("ooye.db") -const sync = new HeatSync({watchFunction: fs.watchFile}) +const sync = new HeatSync({ + watchFunction: (path, options, listener) => fs.watchFile(path, options, (curr, prev) => { + if (curr.mtimeMs !== prev.mtimeMs || curr.size !== prev.size) listener() + }) +}) Object.assign(passthrough, {sync, db}) -- 2.34.1