31 lines
792 B
Python
31 lines
792 B
Python
"""
|
|
Celery configuration and app initialization
|
|
"""
|
|
from celery import Celery
|
|
from app.config import settings
|
|
|
|
# Create Celery app
|
|
celery_app = Celery(
|
|
'mulita',
|
|
broker=settings.celery_broker_url,
|
|
backend=settings.celery_result_backend,
|
|
include=['app.tasks.scan', 'app.tasks.thumbs']
|
|
)
|
|
|
|
# Configure Celery
|
|
celery_app.conf.update(
|
|
task_serializer='json',
|
|
accept_content=['json'],
|
|
result_serializer='json',
|
|
timezone='UTC',
|
|
enable_utc=True,
|
|
task_routes={
|
|
'app.tasks.thumbs.*': {'queue': 'high'},
|
|
'app.tasks.scan.*': {'queue': 'low'},
|
|
},
|
|
task_default_queue='default',
|
|
task_default_exchange='default',
|
|
task_default_exchange_type='direct',
|
|
task_default_routing_key='default',
|
|
broker_connection_retry_on_startup=True,
|
|
) |