-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
area: daemonLogic for FileWatcher and background processes.Logic for FileWatcher and background processes.enhancementNew feature or request (e.g., config file, depth control).New feature or request (e.g., config file, depth control).priority: highImportant features that should be addressed soon.Important features that should be addressed soon.
Description
Problem
Currently, the FileWatcher in daemon mode calls Indexer::update_file synchronously on every file change. This causes the heavy EmbeddingEngine and SQLite DB connections to be re-initialized from scratch every time. When a user saves multiple files rapidly or switches branches, this leads to severe performance bottlenecks, high memory spikes, and event processing delays.
Proposed Solution
- Separate the file watching logic from the processing logic in
src/daemon/watcher.rs. - Introduce a background Worker thread that initializes and holds a long-lived instance of
EmbeddingEngineandContextDbin memory. - Implement an
mpsc(Multi-Producer, Single-Consumer) channel to pass file change events from the Watcher to the Worker.
Definition of Done
- Watcher and Worker are separated into different threads.
-
mpscchannel successfully transmits events between Watcher and Worker. -
EmbeddingEngineis loaded only once when the daemon starts and reused. - Rapid sequential file saves do not cause the daemon to freeze or crash.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: daemonLogic for FileWatcher and background processes.Logic for FileWatcher and background processes.enhancementNew feature or request (e.g., config file, depth control).New feature or request (e.g., config file, depth control).priority: highImportant features that should be addressed soon.Important features that should be addressed soon.