CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
Production-grade media metadata backend per docs/aurora-core-spec.md: Aurora-owned UUIDv7 identity system, normalized movie/TV/people/credits schema, provider abstraction with a TMDb adapter, an idempotent async ingestion pipeline (normalize -> match -> upsert -> provenance), a Postgres FTS/trigram search layer, a stateless FastAPI v1 API with Redis caching/rate-limiting, arq workers, dev/prod Docker Compose topologies, unit + integration + load tests, CI, and architecture/ database/API/ERD documentation. Co-Authored-By: Claude Sonnet 5 <[email protected]>
36 lines
923 B
Python
36 lines
923 B
Python
"""arq job queue connection (Redis-backed), shared by the API (enqueuing)
|
|
and the worker process (consuming) — see app/workers/worker.py."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import AsyncGenerator
|
|
|
|
from arq import ArqRedis, create_pool
|
|
from arq.connections import RedisSettings
|
|
|
|
from app.core.config import get_settings
|
|
|
|
_pool: ArqRedis | None = None
|
|
|
|
|
|
def redis_settings() -> RedisSettings:
|
|
return RedisSettings.from_dsn(get_settings().REDIS_URL)
|
|
|
|
|
|
async def get_arq_pool() -> ArqRedis:
|
|
global _pool
|
|
if _pool is None:
|
|
_pool = await create_pool(redis_settings())
|
|
return _pool
|
|
|
|
|
|
async def get_queue() -> AsyncGenerator[ArqRedis, None]:
|
|
yield await get_arq_pool()
|
|
|
|
|
|
async def close_arq_pool() -> None:
|
|
global _pool
|
|
if _pool is not None:
|
|
await _pool.aclose() # type: ignore[attr-defined] # present at runtime; stubs lag redis-py 5.x
|
|
_pool = None
|