perf(desktop): increase port scan interval and skip scan when no sessions
Closed
FE
7mo ago+6+6+0123456789-2-2-0123456789
Summary
- Increase the periodic port scan interval from 2,500ms to 10,000ms. The hint-based scan already fires within 500ms of detecting "listening on port X" in terminal output, so the periodic sweep is just a safety net and a longer interval is fine.
- Skip the scan entirely when no sessions are registered, avoiding unnecessary
ps/lsofspawns on startup or after all terminals are closed.
Each scan spawns ps (via pidtree) per session plus one lsof call. These process spawns are intercepted by kernel-level security agents (e.g. Elastic Endpoint), which inspect every file those processes open. Reducing scan frequency directly reduces EDR CPU load.
Part of #3235
Summary by cubic
Increase the desktop port scan interval to 10s and skip scans when no sessions exist. The hint-based scan still triggers within 500ms; this reduces background ps/lsof spawns and CPU load with security agents, addressing Linear #3235.
Summary by CodeRabbit
- Chores
- Optimized port scanning behavior to improve efficiency and reduce system resource usage.