forked from 0xWheatyz/SPARC
Fix: share a single pooled DatabaseClient instead of creating one per auth call #878
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 load.Roadmap reference: P1 Error handling and resilience
What to do
auth.pyto use a module-level or dependency-injectedDatabaseClientthat is initialized once.Acceptance criteria
DatabaseClientis created per application process.This issue has been resolved. The changes are already merged into main.
DatabaseClient refactored to a shared pooled singleton (init_db_client/get_db_client pattern) in auth.py, initialized once at startup.
Closing as completed.