fix: Reduce watch service CPU usage by increasing reload interval#458
Merged
phernandez merged 1 commit intomainfrom Dec 17, 2025
Merged
fix: Reduce watch service CPU usage by increasing reload interval#458phernandez merged 1 commit intomainfrom
phernandez merged 1 commit intomainfrom
Conversation
Changed watch_project_reload_interval default from 30s to 300s (5 min) to reduce CPU usage caused by frequent watcher restarts. The watch service was restarting every 30 seconds to reload the project list, causing the watchfiles library to rebuild its internal state. This was especially noticeable on systems with many files. Impact: - Reduces watcher restart frequency by 10x - Should reduce idle CPU usage from 20-30% to 2-3% or less - New projects picked up within 5 min instead of 30 sec - Users can configure lower values if needed Fixes #448 Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com> Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Contributor
|
Claude finished @phernandez's task in 1m 15s —— View job Code Review Complete ✅I've reviewed PR #458 against the Basic Memory team checklist. This is a well-executed performance optimization with minimal, focused changes. Code Quality & Standards
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
SummaryThis PR effectively addresses issue #448 by reducing unnecessary CPU usage in the watch service. The changes are: Strengths:
No issues found. This PR is ready to merge. The 10x reduction in restart frequency (30s → 300s) should significantly reduce CPU usage while still detecting new projects within a reasonable timeframe. Users who frequently add/remove projects can configure a lower value if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces idle CPU usage in the MCP background process from 20-30% to 2-3% by changing the watch service reload interval from 30 seconds to 300 seconds (5 minutes).
Problem
The watch service was restarting the file watcher every 30 seconds to reload the project list. This constant stopping and restarting of the
watchfileslibrary caused high CPU usage, especially with larger projects where the watcher had to rebuild its internal state about monitored files.Solution
watch_project_reload_intervaldefault from 30s to 300s (5 minutes)Impact
Fixes #448
Generated with Claude Code