Skip to content

Commit 670dff8

Browse files
author
Anton
committed
fix: check max_idle_tasks
1 parent c33b758 commit 670dff8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

taskiq/receiver/receiver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def __init__( # noqa: WPS211
7070
self.queue: DequeQueue[bytes] = DequeQueue()
7171

7272
self.sem_idle: Optional[asyncio.Semaphore] = None
73-
if max_idle_tasks and max_idle_tasks > 0:
73+
if max_idle_tasks is not None and max_idle_tasks <= 0:
74+
raise ValueError("`max_idle_tasks` should be greater then zero or None.")
75+
if max_idle_tasks is not None and max_idle_tasks > 0:
7476
self.sem_idle = asyncio.Semaphore(max_idle_tasks)
7577

7678
async def callback( # noqa: C901, WPS213

0 commit comments

Comments
 (0)