#509 [ENGINE/Memory] Unbounded tenant config cache cleanup
Description
Edit**File:** engine/config.py:593-610
**Problem:** The tenant config cache can grow unbounded if tenants are added faster than cleanup runs. Eviction only triggers at max size with a gap between cleanup and eviction.
**Severity:** HIGH
**Fix:** Add more aggressive cleanup when cache > 50% full:
```python
def get_config(tenant_id: str | None = None) -> Config:
with _config_lock:
if len(_tenant_config_instances) > _TENANT_CONFIG_MAX_SIZE // 2:
_cleanup_expired_tenant_configs()
```
**Impact:** Long-running workers may accumulate stale tenant configs.
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...