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
@@ -146,7 +146,7 @@ impl MemoryHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Entities created".to_string()][0].clone())
|
||||
}
|
||||
"create_relations" => {
|
||||
@@ -172,7 +172,7 @@ impl MemoryHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Relations created".to_string()][0].clone())
|
||||
}
|
||||
"add_observations" => {
|
||||
@@ -214,7 +214,7 @@ impl MemoryHandler {
|
||||
g.entities.insert(o.entity_name, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Observations added".to_string()][0].clone())
|
||||
}
|
||||
"delete_entities" => {
|
||||
@@ -235,7 +235,7 @@ impl MemoryHandler {
|
||||
master.relations.retain(|r| {
|
||||
!to_delete.contains(&r.from) && !to_delete.contains(&r.to)
|
||||
});
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Entities deleted".to_string()][0].clone())
|
||||
}
|
||||
"delete_observations" => {
|
||||
@@ -266,7 +266,7 @@ impl MemoryHandler {
|
||||
e.observations.retain(|o| !to_rem.contains(o));
|
||||
}
|
||||
}
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Observations deleted".to_string()][0].clone())
|
||||
}
|
||||
"delete_relations" => {
|
||||
@@ -299,7 +299,7 @@ impl MemoryHandler {
|
||||
r.from, r.to, r.relation_type, r.namespace
|
||||
))
|
||||
});
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Relations deleted".to_string()][0].clone())
|
||||
}
|
||||
"read_graph" => {
|
||||
@@ -526,7 +526,7 @@ impl MemoryHandler {
|
||||
if let Some(e) = master.entities.get_mut(&req.entity_name) {
|
||||
e.observations = req.summarized_observations;
|
||||
}
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Entity condensed".to_string()][0].clone())
|
||||
}
|
||||
"add_task" => {
|
||||
@@ -763,7 +763,7 @@ impl MemoryHandler {
|
||||
}
|
||||
}
|
||||
master.relations = MemoryState::unique_items(master.relations.clone());
|
||||
});
|
||||
}).await;
|
||||
Ok(vec!["Entities merged".to_string()][0].clone())
|
||||
}
|
||||
"find_orphans" => {
|
||||
|
||||
Reference in new issue
Block a user