forked from 0xWheatyz/SPARC
Refactor get_db_client() in auth.py to use a shared pooled DatabaseClient #228
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. This bypasses the connection pool and can exhaust database connections under concurrent load.What to do
DatabaseClientinstance is created for other parts of the application (likely indatabase.pyor the app factory).get_db_client()to return (or yield) the shared, pooled instance rather than creating a new one each time.lifespanhandler).auth.pyinstantiateDatabaseClientindependently.Acceptance criteria
DatabaseClientinstance is used across the application lifecycle.Triage: P1 / small / @developer
Part of P1 security hardening batch (#225-#228). Refactor get_db_client() to use a shared pooled DatabaseClient instead of creating a new connection each call. Batch with #225, #226, #227.
Triage: P1 Resilience - Small complexity. Assigned to @developer.
Delegation: Refactor get_db_client() in auth.py to reuse the shared DatabaseClient instance from database.py instead of creating new connections per call.
Closing as already resolved. This issue is a duplicate of a previously completed issue. The fix has been merged to main via earlier PRs. Verified that the feature/fix exists in the current main branch.