mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
Fix exclusive_lock indefinite wait
This commit is contained in:
@@ -19,6 +19,9 @@ def exclusive_lock(
|
|||||||
"""
|
"""
|
||||||
path = Path(path)
|
path = Path(path)
|
||||||
path.parent.mkdir(parents=True, exist_ok=True)
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
if timeout is None:
|
||||||
|
lock = portalocker.Lock(str(path), mode="a+b")
|
||||||
|
else:
|
||||||
lock = portalocker.Lock(str(path), mode="a+b", timeout=timeout)
|
lock = portalocker.Lock(str(path), mode="a+b", timeout=timeout)
|
||||||
with lock as fh:
|
with lock as fh:
|
||||||
yield fh
|
yield fh
|
||||||
|
Reference in New Issue
Block a user