Description
src/Servy.Core/Helpers/ProcessHelper.cs:57 — GetCpuUsage(int pid) is named as a pure getter but:
- Calls
PruneDeadProcesses() on every invocation (iterates all cached PIDs, removes dead ones)
- Writes a new
CpuSample into the static ConcurrentDictionary on every call
A method named "Get" should not perform maintenance operations or mutate shared state.
Suggested fix
Separate the pruning into an explicit MaintainCache() method called on a timer, and rename or document the state mutation.
Description
src/Servy.Core/Helpers/ProcessHelper.cs:57—GetCpuUsage(int pid)is named as a pure getter but:PruneDeadProcesses()on every invocation (iterates all cached PIDs, removes dead ones)CpuSampleinto the staticConcurrentDictionaryon every callA method named "Get" should not perform maintenance operations or mutate shared state.
Suggested fix
Separate the pruning into an explicit
MaintainCache()method called on a timer, and rename or document the state mutation.