Skip to content

Commit 4f9f1ae

Browse files
authored
fix: multiprocessing start method on darwin platform (#177)
1 parent 87df897 commit 4f9f1ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

taskiq/cli/worker/run.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import logging
33
import signal
44
from concurrent.futures import ThreadPoolExecutor
5+
from multiprocessing import set_start_method
56
from multiprocessing.synchronize import Event
7+
from sys import platform
68
from typing import Any, Type
79

810
from taskiq.abc.broker import AsyncBroker
@@ -158,6 +160,8 @@ def run_worker(args: WorkerArgs) -> None: # noqa: WPS213
158160
159161
:raises ValueError: if reload flag is used, but dependencies are not installed.
160162
"""
163+
if platform == "darwin":
164+
set_start_method("fork")
161165
if args.configure_logging:
162166
logging.basicConfig(
163167
level=logging.getLevelName(args.log_level),

0 commit comments

Comments
 (0)