perf(server): offload sync disk/db IO to tokio blocking thread pool
Makes apply_sync_write, write_to_local_delta, and store modify truly async, preventing the mcp-memory-server from locking the tokio executor during disk IO
This commit is contained in:
1 parent
1fd1d119e6
commit
248799ca5d
5 files changed
+105
-40
No files matched your search
+5
-2
@@ -91,8 +91,11 @@ async fn reconcile_worker(state: Arc<MemoryState>) {
|
||||
};
|
||||
let has_files = glob::glob(&pattern).map(|p| p.count() > 0).unwrap_or(false);
|
||||
if has_local || has_files {
|
||||
state.apply_sync_write(|_master| {});
|
||||
state.rebuild_index();
|
||||
state.apply_sync_write(|_master| {}).await;
|
||||
let state_clone = state.clone();
|
||||
let _ = tokio::task::spawn_blocking(move || {
|
||||
state_clone.rebuild_index();
|
||||
}).await;
|
||||
}
|
||||
|
||||
let now = SystemTime::now()
|
||||
|
||||
Reference in new issue
Block a user