Skip to content

Commit

Permalink
Set multiprocessing method for 'fork' on MacOS + Python 3.8+.
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Jul 31, 2020
1 parent 40eaf6a commit 4c455e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions huey/contrib/djhuey/management/commands/run_huey.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import sys

from django.conf import settings
from django.core.management.base import BaseCommand
Expand Down Expand Up @@ -47,6 +48,12 @@ def add_arguments(self, parser):
def handle(self, *args, **options):
from huey.contrib.djhuey import HUEY

# Python 3.8+ on MacOS uses an incompatible multiprocess model. In this
# case we must explicitly configure mp to use fork().
if sys.version_info >= (3, 8) and sys.platform == 'darwin':
import multiprocessing
multiprocessing.set_start_method('fork')

consumer_options = {}
try:
if isinstance(settings.HUEY, dict):
Expand Down

0 comments on commit 4c455e2

Please sign in to comment.