mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-08 03:28:35 +03:00
20 lines
467 B
Python
20 lines
467 B
Python
|
|
from functools import lru_cache
|
|
from celery import Celery
|
|
import redis
|
|
|
|
from app.shared.settings import get_settings
|
|
|
|
@lru_cache
|
|
def get_celery(name:str="") -> Celery:
|
|
return Celery(
|
|
name,
|
|
broker_url=get_settings().CELERY_BROKER_URL,
|
|
result_backend=get_settings().CELERY_BROKER_URL,
|
|
broker_connection_retry_on_startup=False
|
|
)
|
|
|
|
|
|
def get_redis() -> redis.Redis:
|
|
return redis.Redis.from_url(get_settings().CELERY_BROKER_URL)
|