"""Celery Application Configuration"""
from celery import Celery
from app.config import settings

celery_app = Celery(
    "forge_ai",
    broker=settings.redis_url,
    backend=settings.redis_url,
    include=[
        "app.workers.tasks"
    ]
)

# Celery configuration
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=3600,  # 1 hour max per task
    task_soft_time_limit=3300,  # Soft limit 55 minutes
    worker_prefetch_multiplier=1,
    task_acks_late=True,
    task_reject_on_worker_lost=True,
)
