perf: completely eradicate large vector allocations and state locking double-clones in main, meta, env, workspaces, and notes modules
This commit is contained in:
1 parent
6b37799cc5
commit
9476bcd649
9 files changed
+352
-125
No files matched your search
@@ -61,9 +61,11 @@ impl McpTool for ReadEnvFingerprintHandler {
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> Result<String, String> {
|
||||
let req: ReadEnvFingerprintTool =
|
||||
serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
let fps = state.env_fingerprints.read();
|
||||
if let Some(fp) = fps.get(&req.namespace) {
|
||||
let data = serde_json::to_string(fp).unwrap_or_default();
|
||||
let data = state.env_fingerprints.read_with(|fps| {
|
||||
fps.get(&req.namespace).cloned()
|
||||
});
|
||||
if let Some(fp) = data {
|
||||
let data = serde_json::to_string(&fp).unwrap_or_default();
|
||||
Ok(data.to_string())
|
||||
} else {
|
||||
Ok("{}".to_string())
|
||||
@@ -164,3 +166,4 @@ impl McpTool for GetEnvironmentDetailsHandler {
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user