forked from mtusi2026/mtusi2026lab3
14 lines
295 B
Python
14 lines
295 B
Python
import asyncpg
|
|
from src import config
|
|
|
|
pool: asyncpg.Pool | None = None
|
|
|
|
async def init_db():
|
|
global pool
|
|
pool = await asyncpg.create_pool(dsn=config.DATABASE_URL, min_size=2, max_size=10)
|
|
|
|
async def close_db():
|
|
global pool
|
|
if pool:
|
|
await pool.close()
|
|
pool = None |