per discussion with @bridiver:
We'll want to use fs.fsync when saving session-store-1 to disk. We've had problems with this file being corrupted when a BSOD happens on Windows. The save that happens every 5 mins may not have been flushed.
Notes from the discussion:
writeSync doesn鈥檛 force a sync to diskMOVEFILE_WRITE_THROUGH flagWe can use this API for doing the write:
https://github.com/brave/muon/commit/2da2701bb2bc3580fa5bac16fee5b9d20d4eedb1
muon.file.writeImportant(path, contents, cb(success))
The api handles serializing the saves on a per-filename basis and also blocks app.quit until the save is completed. No extra code to queue/block simultaneous writes is required and all writes happen on a separate thread.
Most helpful comment
muon.file.writeImportant(path, contents, cb(success))The api handles serializing the saves on a per-filename basis and also blocks
app.quituntil the save is completed. No extra code to queue/block simultaneous writes is required and all writes happen on a separate thread.