lab3 completed

This commit is contained in:
kuruoni
2026-11-24 23:07:02 +03:00
parent 0ab3a341aa
commit 06e12d8734
26 changed files with 1034 additions and 33 deletions
+28
View File
@@ -0,0 +1,28 @@
import os
import asyncpg
DATABASE_URL = os.getenv(
"DATABASE_URL",
"postgresql://messenger:secret_password@postgres:5432/messenger_db"
)
pool: asyncpg.Pool = None
async def init_db():
global pool
pool = await asyncpg.create_pool(
DATABASE_URL,
min_size=2,
max_size=10
)
async def close_db():
global pool
if pool:
await pool.close()
def get_pool() -> asyncpg.Pool:
return pool