| """Celery application factory.""" | |
| from __future__ import annotations | |
| from celery import Celery | |
| from config import settings | |
| celery_app = Celery( | |
| "nexus", | |
| broker=settings.REDIS_URL, | |
| backend=settings.REDIS_URL, | |
| include=["workers.tasks"], | |
| ) | |
| celery_app.conf.update( | |
| task_serializer="json", | |
| accept_content=["json"], | |
| result_serializer="json", | |
| timezone="UTC", | |
| enable_utc=True, | |
| task_track_started=True, | |
| task_time_limit=60 * 30, | |
| task_soft_time_limit=60 * 25, | |
| worker_prefetch_multiplier=1, | |
| broker_connection_retry_on_startup=True, | |
| ) | |