Initial commit: webmail client (M0/M1)
Three-pane webmail client. - Backend: FastAPI + async SQLAlchemy + arq worker (Postgres/Redis), IMAP/SMTP sync, threading, search, drafts/outbox with undo, attachments, 2FA. - Frontend: React 18 + Vite + TypeScript + TanStack Query + Tailwind; three-pane UI with rich-text composer, light/dark themes, resizable panels. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""arq queue helpers (enqueue side, used by the API)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from arq import create_pool
|
||||
from arq.connections import ArqRedis, RedisSettings
|
||||
|
||||
from app.config import get_settings
|
||||
|
||||
_pool: ArqRedis | None = None
|
||||
|
||||
|
||||
def redis_settings() -> RedisSettings:
|
||||
"""Return arq RedisSettings derived from ``REDIS_URL``."""
|
||||
return RedisSettings.from_dsn(get_settings().redis_url)
|
||||
|
||||
|
||||
async def get_arq_pool() -> ArqRedis:
|
||||
"""Return (creating on first use) the shared arq enqueue pool."""
|
||||
global _pool
|
||||
if _pool is None:
|
||||
_pool = await create_pool(redis_settings())
|
||||
return _pool
|
||||
|
||||
|
||||
async def close_arq_pool() -> None:
|
||||
"""Close the arq pool."""
|
||||
global _pool
|
||||
if _pool is not None:
|
||||
await _pool.aclose()
|
||||
_pool = None
|
||||
Reference in New Issue
Block a user