Files
LockInBroAPI/app/services/db.py

19 lines
365 B
Python
Raw Normal View History

2026-03-29 06:57:34 -04:00
import asyncpg
from app.config import settings
pool: asyncpg.Pool | None = None
async def get_pool() -> asyncpg.Pool:
global pool
if pool is None:
pool = await asyncpg.create_pool(settings.DATABASE_URL, min_size=2, max_size=10)
return pool
async def close_pool():
global pool
if pool:
await pool.close()
pool = None