Hacker News new | ask | show | jobs
by djbusby 1534 days ago
Is it possible a write is interrupted on it's turn in the event-loop, and crossed with another?
1 comments

Hmm. I wouldn't think so, but I don't actually know

Still, given the strategy at hand, the in-memory JS object (exclusively single-threaded) is the source of truth, and just gets mirrored in the file system (and doesn't get read again until the next startup). So you should have an eventual-consistency situation in the worst case (any racing issue between file-writes would just put the file in a stale state, and the next file-write would bring it back up to consistency)