mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-12 05:32:36 +00:00
The Set mutex serialised writes but left Delete, expiry, and eviction racing the same counters, so double subtraction remained. Eviction also pre-allocated from the configured maximum, which could allocate hundreds of megabytes on a near-empty cache. Use sync.Map.Swap in Set and adjust counters from the linearized previous value. Size the eviction slice from the live entry count. CleanExpiredEntries now subtracts the size of the entry it actually deleted. A concurrency test recomputes expected counters from the final map contents.