Skip to content

Commit

Permalink
Update on "Adding lock mechanism to prevent on_disk_cache downloading…
Browse files Browse the repository at this point in the history
… twice"


Fixes #144

[ghstack-poisoned]
  • Loading branch information
VitalyFedyunin committed May 18, 2022
1 parent a604884 commit 9002589
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchdata/datapipes/iter/util/cacheholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _hash_check(filepath, hash_dict, hash_type):
else:
hash_func = hashlib.md5()

with portalocker.Lock(filepath, "rb") as f:
with portalocker.Lock(filepath, "rb", flags=portalocker.LockFlags.EXCLUSIVE) as f:
chunk = f.read(1024 ** 2)
while chunk:
hash_func.update(chunk)
Expand Down

0 comments on commit 9002589

Please sign in to comment.