#539 [API/Perf] rbac.py N+1 DB queries - no permission cache

closed high Created 2025-12-17 16:29 · Updated 2025-12-17 18:56

Description

Edit
File: api/middleware/rbac.py:659-661. Every permission check opens new DB connection and creates new auth_client session. On 10000 requests/minute, this creates 10000+ DB round-trips just for RBAC. IMPACT: Severe database pressure. FIX: Add request-scoped permission cache using ContextVar.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...