From 5518c9523729e5c1f6cdb8dd1892ded8d0ed8c71 Mon Sep 17 00:00:00 2001 From: giles Date: Tue, 24 Feb 2026 17:08:00 +0000 Subject: [PATCH] Bound connection pool to prevent max_connections exhaustion pool_size=5, max_overflow=10 per app (6 apps = 90 max connections). Previously pool_size=0 meant unlimited connections, causing asyncpg.TooManyConnectionsError under concurrent load. Co-Authored-By: Claude Opus 4.6 --- db/session.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/session.py b/db/session.py index 8e60fae..87fd776 100644 --- a/db/session.py +++ b/db/session.py @@ -15,7 +15,8 @@ _engine = create_async_engine( future=True, echo=False, pool_pre_ping=True, - pool_size=0, # 0 = unlimited (NullPool equivalent for asyncpg) + pool_size=5, + max_overflow=10, ) _Session = async_sessionmaker(