diff --git a/contentcuration/contentcuration/settings.py b/contentcuration/contentcuration/settings.py index 0f18ed0131..285e7bef76 100644 --- a/contentcuration/contentcuration/settings.py +++ b/contentcuration/contentcuration/settings.py @@ -348,6 +348,11 @@ def gettext(s): "result_serializer": "json", "result_extended": True, "worker_send_task_events": True, + # Graceful shutdown: allow 28 seconds for tasks to complete before forced termination + # This is 2 seconds less than Kubernetes terminationGracePeriodSeconds (30s) + "worker_soft_shutdown_timeout": int( + os.getenv("CELERY_WORKER_SOFT_SHUTDOWN_TIMEOUT", "28") + ), } # When cleaning up orphan nodes, only clean up any that have been last modified diff --git a/docker-compose.yml b/docker-compose.yml index 68bb5e2500..719fc797ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ x-studio-environment: CELERY_BROKER_ENDPOINT: redis CELERY_RESULT_BACKEND_ENDPOINT: redis CELERY_REDIS_PASSWORD: "" + REMAP_SIGTERM: "SIGQUIT" PROBER_STUDIO_BASE_URL: http://studio-app:8080/{path} x-studio-worker: