forked from mtusi2026/mtusi2026lab3
4_grade
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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
|
||||
Reference in New Issue
Block a user