heatsync stability fixes #98

Manually merged
cadence merged 1 commit from l1s5/out-of-your-element:heatsync-fixes into main 2026-10-26 11:25:52 +00:00
Showing only changes of commit e2ed40da61 - Show all commits

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.
l1s5 2026-10-25 03:00:07 +09:00
Signed by untrusted user: l1s5
GPG key ID: D0A90CC905B58D9B

View file

@ -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})