From 0a41bd84b937a289bdeaefef10ab921c0b5e2dd4 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Mon, 30 Jun 2025 14:30:56 -0400 Subject: [PATCH] Fix exclusive_lock indefinite wait --- src/utils/file_lock.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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