mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
rwlock: flush and fsync
It is important that we ensure that rwlocked contents are flushed to disk, because otherwise other rwlock readers might get outdated state. Kudos @shcheklein for catching this one.
This commit is contained in:
@@ -50,6 +50,9 @@ def _edit_rwlock(lock_dir):
|
||||
yield lock
|
||||
with open(path, "w+") as fobj:
|
||||
json.dump(lock, fobj)
|
||||
# NOTE: flush and fsync to ensure that rwlock contents are saved
|
||||
fobj.flush()
|
||||
os.fsync(fobj.fileno())
|
||||
|
||||
|
||||
def _infos_to_str(infos):
|
||||
|
||||
Reference in New Issue
Block a user