mirror of
https://github.com/smittix/intercept.git
synced 2026-06-08 22:21:55 -07:00
646eb09e1d
Modify DataStore.cleanup() to minimize lock hold duration: - Snapshot timestamps under lock (brief O(1) list copy) - Compute expired keys outside lock (no contention during O(n) scan) - Re-acquire lock only for deletion with re-validation (ensures entries refreshed between snapshot and deletion are not deleted) This reduces blocking of reader threads and prevents latency spikes during periodic cleanup of large stores (10K+ entries). Also adds tests: - test_cleanup_removes_expired_keeps_fresh: basic cleanup behavior - test_cleanup_does_not_delete_refreshed_entry: re-validation guard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>