#510 [ENGINE/Memory] Vault secret cache entries never proactively removed
Description
Edit**File:** engine/config.py:82-83
**Problem:** Cache entries are checked for expiration on read but expired entries are never proactively removed. Over long worker lifetimes, cache accumulates thousands of expired entries never accessed again.
**Severity:** HIGH
**Fix:** Add periodic cleanup method:
```python
def _cleanup_expired_vault_cache(self) -> None:
current_time = time.time()
with self._vault_cache_lock:
expired_keys = [
key for key, (_, cached_at) in self._vault_cache.items()
if current_time - cached_at > VAULT_CACHE_TTL_SECONDS
]
for key in expired_keys:
del self._vault_cache[key]
```
**Impact:** Memory growth in long-running workers.
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...