From d8237b80cedf686170bba5174fa3e060de5cf51d Mon Sep 17 00:00:00 2001 From: Dmitry Ivakhnenko Date: Sat, 30 Dec 2023 13:44:40 +0300 Subject: [PATCH] Set uvloop for current thread explicitly. (#270) --- taskiq/cli/worker/run.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/taskiq/cli/worker/run.py b/taskiq/cli/worker/run.py index 09c71b0..055148e 100644 --- a/taskiq/cli/worker/run.py +++ b/taskiq/cli/worker/run.py @@ -117,7 +117,9 @@ def interrupt_handler(signum: int, _frame: Any) -> None: loop = uvloop.new_event_loop() # type: ignore else: loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) + + asyncio.set_event_loop(loop) + # This option signals that current # broker is running as a worker. # We must set this field before importing tasks,