From 11c5dbfbc5ac9e8099fea344842acbe2a2fab566 Mon Sep 17 00:00:00 2001 From: Jaimyn Mayer Date: Fri, 31 May 2024 11:45:34 +1000 Subject: [PATCH] update celery prom server signal --- memberportal/membermatters/celeryapp.py | 5 +++-- memberportal/membermatters/settings.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/memberportal/membermatters/celeryapp.py b/memberportal/membermatters/celeryapp.py index 827298de..c19a8ae5 100644 --- a/memberportal/membermatters/celeryapp.py +++ b/memberportal/membermatters/celeryapp.py @@ -1,6 +1,6 @@ import os from celery import Celery -from celery.signals import celeryd_init +from celery.signals import worker_init from prometheus_client import CollectorRegistry, multiprocess, start_http_server import logging @@ -27,8 +27,9 @@ def debug_task(self): print(f"Request: {self.request!r}") -@celeryd_init.connect +@worker_init.connect def celery_prom_server(sender=None, conf=None, **kwargs): + print("Starting CollectorRegistry() and multiprocess.MultiProcessCollector()...") logger.info( "Starting CollectorRegistry() and multiprocess.MultiProcessCollector()..." ) diff --git a/memberportal/membermatters/settings.py b/memberportal/membermatters/settings.py index 83bef1ce..07961bfc 100644 --- a/memberportal/membermatters/settings.py +++ b/memberportal/membermatters/settings.py @@ -338,6 +338,7 @@ # Enable celery events for danihodovic/celery-exporter CELERY_WORKER_SEND_TASK_EVENTS = True CELERY_TASK_SEND_SENT_EVENT = True +CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True # Needed for testing OIDC on local development environment with ngrok (oauth requires HTTPS) # SITE_URL = "https://1bd0-122-148-148-138.ngrok-free.app"