Spaces:
Sleeping
Sleeping
File size: 563 Bytes
0fdb7bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """Helpers used by the API to enqueue background jobs into Redis (arq)."""
from arq import create_pool
from arq.connections import ArqRedis, RedisSettings
from app.core.config import settings
QUEUE_NAME = "mmap-ocr"
def redis_settings() -> RedisSettings:
return RedisSettings(
host=settings.redis_host,
port=settings.redis_port,
password=settings.redis_password or None,
ssl=settings.redis_secure,
)
async def get_arq_pool() -> ArqRedis:
return await create_pool(redis_settings(), default_queue_name=QUEUE_NAME)
|