diff --git a/database.py b/database.py index 162c3bd..398c8b7 100644 --- a/database.py +++ b/database.py @@ -168,7 +168,9 @@ CREATE INDEX IF NOT EXISTS idx_friendly_names_latest ON friendly_names(actor_id, async def init_db(): """Initialize database connection pool and create schema.""" global pool - pool = await asyncpg.create_pool(DATABASE_URL) + if pool is not None: + return # Already initialized + pool = await asyncpg.create_pool(DATABASE_URL, min_size=2, max_size=10) async with pool.acquire() as conn: await conn.execute(SCHEMA_SQL)