Skip to content

Commit 67759cd

Browse files
committed
PYTHON-5167 Async Condition.wait has to reacquire the lock even after a timeout
1 parent e52965e commit 67759cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pymongo/lock.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ def _release_locks() -> None:
8282

8383

8484
async def _async_cond_wait(condition: Condition, timeout: Optional[float]) -> bool:
85+
fut = asyncio.ensure_future(condition.wait())
8586
try:
86-
return await wait_for(condition.wait(), timeout)
87+
return await wait_for(fut, timeout)
8788
except asyncio.TimeoutError:
89+
await fut
8890
return False
8991

9092

0 commit comments

Comments
 (0)