forked from 0xWheatyz/SPARC
Fix get_db_client() in auth.py to use a shared connection pool #308
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Roadmap item: P1 Error handling and resilience
get_db_client()inauth.pyinstantiates a newDatabaseClienton every invocation. Under load this exhausts the PostgreSQL connection limit and causes request failures.Work Required
DatabaseClientmanages connections (asyncpg pool, psycopg2 pool, etc.)get_db_client()to return a module-level singleton or a FastAPI dependency that shares a single pooled client across requestsDatabaseClient()constructor calls inauth.pyAcceptance Criteria
This issue has already been resolved in the fork's main branch. Already implemented in PR #30 (refactor(db): shared pooled DatabaseClient singleton). See SPARC/database.py.
Closing as completed.