From b956f3c0a5bd9ee39d1d19a9284dc532b34aaee6 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 26 Jan 2022 22:40:02 +0100 Subject: [PATCH] misc: fork before sending message to celery (#26911) --- hobo/agent/common/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hobo/agent/common/__init__.py b/hobo/agent/common/__init__.py index b8663a6..1257fe4 100644 --- a/hobo/agent/common/__init__.py +++ b/hobo/agent/common/__init__.py @@ -1,3 +1,5 @@ +import os + from celery import Celery from django.conf import settings from django.db import connection @@ -14,6 +16,10 @@ def notify_agents(data): 'tenant': tenant.domain_url, 'data': data, } + pid = os.fork() + if pid: + os.waipid(pid, 0) + return with Celery('hobo', broker=settings.BROKER_URL) as app: app.conf.update( CELERY_TASK_SERIALIZER='json', -- 2.34.1