Fix exclusive_lock indefinite wait

This commit is contained in:
thePR0M3TH3AN committed 2025-06-30 14:30:56 -04:00
1 parent 57fde0139f
commit 0a41bd84b9
1 file changed
+4 -1
+4 -1
View File
@@ -19,7 +19,10 @@ def exclusive_lock(
"""
path = Path(path)
path.parent.mkdir(parents=True, exist_ok=True)
lock = portalocker.Lock(str(path), mode="a+b", timeout=timeout)
if timeout is None:
lock = portalocker.Lock(str(path), mode="a+b")
else:
lock = portalocker.Lock(str(path), mode="a+b", timeout=timeout)
with lock as fh:
yield fh