Skip to content

perf(MCP server): add 5s cooldown and reduce per-call overhead for on-demand refresh #7

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

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

Conversation

@Djentinga
Copy link
Copy Markdown
Contributor

Some additional performance improvements.

Every MCP tool call triggered a full filesystem scan and held a write lock for the entire duration. For large solutions this added seconds of latency to every tool invocation.

  • Add tiered cooldowns: 5s for document timestamps, 60s for directory scans
  • Move stat collection outside the write lock so concurrent tool calls are not blocked while checking for changes
  • Cache file paths and project IDs in DocumentInfo record to eliminate Roslyn GetDocument() lookups in the refresh hot path
  • Remove redundant File.Exists calls (GetLastWriteTimeUtc returns a sentinel for missing files)
  • Pre-compute bin/obj path prefixes to avoid per-file string allocation
  • Simplify RefreshChangedDocumentsAsync to return Task (result was unused)
  • Bump to 0.7.1

Every MCP tool call triggered a full filesystem scan and held a write lock
for the entire duration. For large solutions this added seconds of latency
to every tool invocation.

- Add tiered cooldowns: 5s for document timestamps, 60s for directory scans
- Move stat collection outside the write lock so concurrent tool calls
  are not blocked while checking for changes
- Cache file paths and project IDs in DocumentInfo record to eliminate
  Roslyn GetDocument() lookups in the refresh hot path
- Remove redundant File.Exists calls (GetLastWriteTimeUtc returns a
  sentinel for missing files)
- Pre-compute bin/obj path prefixes to avoid per-file string allocation
- Simplify RefreshChangedDocumentsAsync to return Task (result was unused)
- Bump to 0.6.3
@iammukeshm iammukeshm merged commit 53036d6 into codewithmukesh:main Mar 24, 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