Skip to content

Commit

Permalink
fix:task ordering and extend Celery task time limit.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hareshkainthdbt committed Jan 20, 2025
1 parent 0198ad2 commit ca5be56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion celery_worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion fbr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca5be56

Please sign in to comment.