diff --git a/src/utils/file_lock.py b/src/utils/file_lock.py index 4d674f2..5ffba52 100644 --- a/src/utils/file_lock.py +++ b/src/utils/file_lock.py @@ -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