Skip to content

perf: add 5s cooldown and reduce per-call overhead for on-demand refresh#6

Merged
iammukeshm merged 1 commit intocodewithmukesh:mainfrom
Djentinga:fix/inotify-watcher-exhaustion
Mar 20, 2026
Merged

perf: add 5s cooldown and reduce per-call overhead for on-demand refresh#6
iammukeshm merged 1 commit intocodewithmukesh:mainfrom
Djentinga:fix/inotify-watcher-exhaustion

Conversation

@Djentinga
Copy link
Copy Markdown
Contributor

Fixing an issue from my last PR.

Every MCP tool call triggered a full filesystem scan (stat every document + enumerate all project directories for new .cs files). For large solutions on WSL this added noticeable latency to every tool invocation.

  • Add 5-second cooldown so rapid-fire tool calls skip the scan entirely
  • Split structural check into cheap .csproj timestamp check (short-circuits) and expensive directory scan (only runs if .csproj unchanged)
  • Flatten Phase 2 loop: iterate _knownFileTimestamps directly instead of nested project→document resolution through Roslyn objects
  • Use EnumerationOptions to skip hidden/system files at the OS level

Every MCP tool call triggered a full filesystem scan (stat every document +
enumerate all project directories for new .cs files). For large solutions on
WSL this added noticeable latency to every tool invocation.

- Add 5-second cooldown so rapid-fire tool calls skip the scan entirely
- Split structural check into cheap .csproj timestamp check (short-circuits)
  and expensive directory scan (only runs if .csproj unchanged)
- Flatten Phase 2 loop: iterate _knownFileTimestamps directly instead of
  nested project→document resolution through Roslyn objects
- Use EnumerationOptions to skip hidden/system files at the OS level
@Djentinga Djentinga force-pushed the fix/inotify-watcher-exhaustion branch from 806acf3 to f3c1faf Compare March 19, 2026 07:23
@iammukeshm iammukeshm merged commit 2aa4442 into codewithmukesh:main Mar 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants