From af87da876b2789079a5255dae52f92b74a63f52d Mon Sep 17 00:00:00 2001 From: Joel Falknau Date: Mon, 7 Apr 2025 14:01:33 +1000 Subject: [PATCH] Celery 5.5 + shutdown timeouts --- docker/conf/celery.py | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/conf/celery.py b/docker/conf/celery.py index 6d0c5a8e..6a386526 100644 --- a/docker/conf/celery.py +++ b/docker/conf/celery.py @@ -14,6 +14,10 @@ app = Celery('myauth') # Celery startup if it is unavailable. app.conf.broker_connection_retry_on_startup = True +# Set a hard task execution time of 5 minutes before celery will cold restart +app.conf.worker_soft_shutdown_timeout = 300 +app.conf.worker_enable_soft_shutdown_on_idle = True + # Using a string here means the worker don't have to serialize # the configuration object to child processes. app.config_from_object('django.conf:settings') diff --git a/pyproject.toml b/pyproject.toml index 3e91e70c..2fd29ad7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ dynamic = [ dependencies = [ "bcrypt", "beautifulsoup4", - "celery>=5.4,<6", + "celery>=5.5,<6", "celery-once>=3.0.1", "django>=5.1,<5.2", "django-bootstrap-form",