heatsync stability fixes #98
1 changed files with 5 additions and 1 deletions
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.
commit
e2ed40da61
6
start.js
6
start.js
|
|
@ -13,7 +13,11 @@ const {reg} = require("./src/matrix/read-registration")
|
||||||
const passthrough = require("./src/passthrough")
|
const passthrough = require("./src/passthrough")
|
||||||
const db = new sqlite("ooye.db")
|
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})
|
Object.assign(passthrough, {sync, db})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue