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 Aug 3, 2022. It is now read-only.
If 2 fs.rename()s are called at almost the same time, there will be a race condition, and the execution result is not determined. One of them will lose its operations.
db.save("id",{number: 1},function(err){if(err){console.error(err);}});db.save("id",{number: 2},function(err){if(err){console.error(err);}});// {"number":1} or {"number":2} in id.json
This problem affects both save() and delete().
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
saveObjectToFile()
writes the object to a temporary file first, and then uses asynchronousfs.rename()
to move the temporary file to the target file:json-file-store/Store.es6.js
Lines 78 to 83 in 6aada66
If 2
fs.rename()
s are called at almost the same time, there will be a race condition, and the execution result is not determined. One of them will lose its operations.This problem affects both
save()
anddelete()
.The text was updated successfully, but these errors were encountered: