Skip to content

Commit 897b1ed

Browse files
fix: Reduce watch service CPU usage by increasing reload interval (#458)
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>
1 parent 0c12a39 commit 897b1ed

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/basic_memory/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ class BasicMemoryConfig(BaseSettings):
122122
)
123123

124124
watch_project_reload_interval: int = Field(
125-
default=30, description="Seconds between reloading project list in watch service", gt=0
125+
default=300,
126+
description="Seconds between reloading project list in watch service. Higher values reduce CPU usage by minimizing watcher restarts. Default 300s (5 min) balances efficiency with responsiveness to new projects.",
127+
gt=0,
126128
)
127129

128130
# update permalinks on move

tests/sync/test_watch_service_reload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def stop_after_one_call(*args):
8585
with patch.object(watch_service, "write_status", return_value=None):
8686
await watch_service.run()
8787

88-
# Should have slept for 30 seconds when no projects found
89-
mock_sleep.assert_called_with(30)
88+
# Should have slept for the configured reload interval when no projects found
89+
mock_sleep.assert_called_with(config.watch_project_reload_interval)
9090

9191

9292
@pytest.mark.asyncio

0 commit comments

Comments
 (0)