From ca5be5654d6ee3f48f28d1b22b96005d315875da Mon Sep 17 00:00:00 2001 From: Haresh Kainth Date: Mon, 20 Jan 2025 10:53:52 +0000 Subject: [PATCH] fix:task ordering and extend Celery task time limit. Reordered cache-building tasks in `tasks.py` to ensure proper execution flow. Increased the Celery task time limit from 30 minutes to 60 minutes in `settings.py` to accommodate potentially longer-running processes. --- celery_worker/tasks.py | 2 +- fbr/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/celery_worker/tasks.py b/celery_worker/tasks.py index f40c366..122c4d9 100644 --- a/celery_worker/tasks.py +++ b/celery_worker/tasks.py @@ -27,8 +27,8 @@ def rebuild_cache(): start = time.time() clear_all_documents() config = SearchDocumentConfig(search_query="", timeout=2) - Legislation().build_cache(config) PublicGateway().build_cache(config) + Legislation().build_cache(config) end = time.time() message = { "message": "rebuilt cache", diff --git a/fbr/settings.py b/fbr/settings.py index 76f29bb..fe8de6a 100644 --- a/fbr/settings.py +++ b/fbr/settings.py @@ -198,7 +198,7 @@ CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers.DatabaseScheduler" CELERY_RESULT_EXTENDED = True CELERY_TASK_TIME_LIMIT = ( - 1800 # Maximum runtime for a task in seconds (e.g., 1800/60 = 30 minutes) + 3600 # Maximum runtime for a task in seconds (e.g., 3600/60 = 60 minutes) ) CELERY_TASK_SOFT_TIME_LIMIT = ( 270 # Optional: Grace period before forced termination