Skip to content

Commit 241c770

Browse files
Fix timeout on async locks
1 parent 9f7dc7a commit 241c770

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nebula/core/utils/locker.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ async def acquire_async(self, *args, **kwargs):
6464
if not self._async_lock:
6565
raise RuntimeError("Use 'acquire' for acquiring non-async locks")
6666
if self._verbose:
67-
logging.debug(f"🔒 Acquiring async lock [{self._name}] from {filename}:{lineno}")
68-
await self._lock.acquire()
67+
if "timeout" in kwargs:
68+
logging.debug(
69+
f"🔒 Acquiring async lock [{self._name}] from {filename}:{lineno} with timeout {kwargs['timeout']}"
70+
)
71+
else:
72+
logging.debug(f"🔒 Acquiring async lock [{self._name}] from {filename}:{lineno}")
73+
await self._lock.acquire(*args, **kwargs)
6974

7075
async def release_async(self, *args, **kwargs):
7176
caller = inspect.stack()[1]

0 commit comments

Comments
 (0)