You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.
If the Superpowers server happens to crash, it is important that files are fully written to minimize the risk of user data corruption.
We should have a facility that writes to a temporary file and then renames it in an atomic operation on top of the existing file when it is done writing. There are probably npm modules to do this. The following is important:
The API we expose to plugins and systems should be simple to use and fool-proof
The temporary files should have a unique name and be created next to the final files, so that if and when we crash, the temporary files can be easily located and used for data recovery.
The text was updated successfully, but these errors were encountered:
If we are going to write all the time on the disk, wouldn't it be simpler to decrease the interval between the "change" event and the actuel write operation ?
I believe the delay between the two was precisely to prevent writing on the disk all the time ?
elisee
changed the title
Use and provide an atomic way for systems/plugins to write files
Provide an atomic way for systems/plugins to write files
Jan 18, 2016
This issue is not about saving right away all the time (that would not be a good idea, for the reasons you mentioned). It's about making sure that when we do write (at most once every 60s for a particular asset), if there's a crash at that precise moment, we don't want to end up with empty or incomplete files because they were in the process of being overwritten. It's a rare bug but it has happened a few times.
If the Superpowers server happens to crash, it is important that files are fully written to minimize the risk of user data corruption.
We should have a facility that writes to a temporary file and then renames it in an atomic operation on top of the existing file when it is done writing. There are probably npm modules to do this. The following is important:
The text was updated successfully, but these errors were encountered: