We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3aaa478 commit 701c798Copy full SHA for 701c798
packages/service-library/src/servicelib/redis/_semaphore_decorator.py
@@ -43,7 +43,10 @@ async def _managed_semaphore_execution(
43
raise SemaphoreAcquisitionError(name=semaphore_key, capacity=semaphore.capacity)
44
45
try:
46
- # Use TaskGroup for proper exception propagation
+ # NOTE: Use TaskGroup for proper exception propagation, this ensures that in case of error the context manager will be properly exited
47
+ # and the semaphore released.
48
+ # If we use create_task() directly, exceptions in the task are not propagated to the parent task
49
+ # and the context manager may never exit, leading to semaphore leaks.
50
async with asyncio.TaskGroup() as tg:
51
started_event = asyncio.Event()
52
0 commit comments