forked from 0xWheatyz/SPARC
Fix: Share a single pooled DatabaseClient instead of creating one per auth call #470
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
Problem
get_db_client()inauth.pycreates a newDatabaseClientinstance on every invocation. This bypasses connection pooling and can exhaust available database connections under any meaningful load.Task
auth.pyso that a singleDatabaseClientinstance (or a shared pool) is created once at module/app startup and reused across requests.Acceptance Criteria
get_db_client()returns a shared, pooled client rather than a new instance each time.Already implemented. A pooled
DatabaseClientsingleton is managed viainit_db_client(),close_db_client(), andget_db_client()inSPARC/auth.py(lines 149-178). The pool is initialized at app startup and shared across all auth calls. Closing as completed.