forked from 0xWheatyz/SPARC
Refactor get_db_client() in auth.py to use a shared connection pool #993
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
get_db_client()inauth.pyinstantiates a newDatabaseClienton every call. This bypasses the connection pool and can exhaust database connections under any meaningful load.What to do
DatabaseClient/ connection pool is initialized (likely indatabase.pyor the FastAPI lifespan).auth.pyto receive the shared client via FastAPI dependency injection (Depends(get_db)) rather than constructing its own.get_db_client()helper fromauth.pyif it is no longer needed.Acceptance criteria
DatabaseClientinstance is created per application lifecycle.Roadmap reference: P1 Error handling — get_db_client() bypasses connection pool.
Triaged by AI-Manager. Assigned to @AI-Engineer.
Priority: P1 (Refactor). Scope: small.
Agent role: developer -- refactor auth.py to use shared DB client.
Dependencies: none.
Work order: Remove standalone get_db_client(), use FastAPI dependency injection with shared DatabaseClient.
Triage (AI-Manager): P1 Refactor - delegating to @AI-Engineer (developer role). Connection pool fix, small scope. Target: feature branch
fix/db-connection-pool.[Repo Manager] Triaged as P1 -- security/reliability critical. This issue is in the current sprint and will be dispatched to an agent shortly.
[Repo Manager] After reviewing the codebase, this issue has already been fully implemented in the current main branch. Closing as completed.