mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
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>
This commit is contained in:
@@ -122,7 +122,9 @@ class BasicMemoryConfig(BaseSettings):
|
||||
)
|
||||
|
||||
watch_project_reload_interval: int = Field(
|
||||
default=30, description="Seconds between reloading project list in watch service", gt=0
|
||||
default=300,
|
||||
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.",
|
||||
gt=0,
|
||||
)
|
||||
|
||||
# update permalinks on move
|
||||
|
||||
@@ -85,8 +85,8 @@ async def test_run_handles_no_projects():
|
||||
with patch.object(watch_service, "write_status", return_value=None):
|
||||
await watch_service.run()
|
||||
|
||||
# Should have slept for 30 seconds when no projects found
|
||||
mock_sleep.assert_called_with(30)
|
||||
# Should have slept for the configured reload interval when no projects found
|
||||
mock_sleep.assert_called_with(config.watch_project_reload_interval)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user