forked from 0xWheatyz/SPARC
Refactor get_db_client() in auth.py to use a shared pooled DatabaseClient #852
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.pycreates a newDatabaseClienton every call. This bypasses the connection pool and can exhaust database connections under load.Work to do
DatabaseClientis initialized (likely inmain.pyor adependencies.pymodule).auth.pyto accept the shared client via FastAPI dependency injection (e.g.,Depends(get_db)) rather than constructing a new instance.get_db_client()factory inauth.py.Acceptance criteria
auth.pyno longer creates its ownDatabaseClient.