forked from 0xWheatyz/SPARC
Refactor get_db_client() in auth.py to use a shared connection pool #686
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 call. Under concurrent load this exhausts available database connections because each request opens a new connection without reuse.Work to do
auth.pyto obtain theDatabaseClientfrom the shared pool used elsewhere in the application (e.g. via FastAPI dependency injection or a module-level singleton)Acceptance criteria
get_db_client()no longer creates a newDatabaseClientinstance per callClosing as already implemented. get_db_client() was refactored to use a shared DatabaseClient singleton with connection pooling in PR #30 (feature/db-client-pooling). See SPARC/database.py.