packages/django-dramatiq-postgres: fix worker startup on macos (cherry-pick #20637 to version-2026.2) (#20641)

packages/django-dramatiq-postgres: fix worker startup on macos (#20637)

fix worker startup on macos

Co-authored-by: Simonyi Gergő <28359278+gergosimonyi@users.noreply.github.com>
This commit is contained in:
authentik-automation[bot]
2026-03-01 01:31:21 +00:00
committed by GitHub
parent fc6f8374e6
commit 29d880920e
@@ -1,3 +1,4 @@
import platform
import sys
from argparse import Namespace
from multiprocessing import set_start_method
@@ -70,7 +71,10 @@ class Command(BaseCommand):
args.pid_file = pid_file
args.verbose = verbosity - 1
set_start_method("fork")
# > On macOS [...] the fork start method should be considered unsafe
# https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
if not platform.system() == "Darwin":
set_start_method("fork")
connections.close_all()
sys.exit(main(args)) # type: ignore[no-untyped-call]