refactor: apply 5-pass audit optimizations across mcp-memory codebase
This commit is contained in:
1 parent
924b6d09fa
commit
5bd8b1587a
43 files changed
+1866
-1658
No files matched your search
@@ -46,7 +46,7 @@ impl McpTool for TasksHandler {
|
||||
acceptance_criteria: vec![],
|
||||
expires_at: None,
|
||||
};
|
||||
let idx = state.get_search_index();
|
||||
let idx = state.get_search_index().await;
|
||||
drop(idx.index_task(&task));
|
||||
state.project.tasks.modify(|tasks| {
|
||||
tasks.push(task.clone());
|
||||
@@ -187,7 +187,7 @@ impl McpTool for TasksHandler {
|
||||
});
|
||||
|
||||
if deleted_count > 0 {
|
||||
let idx = state.get_search_index();
|
||||
let idx = state.get_search_index().await;
|
||||
for deleted_id in actually_deleted {
|
||||
drop(idx.delete_document(&deleted_id));
|
||||
}
|
||||
@@ -228,7 +228,8 @@ impl McpTool for TasksHandler {
|
||||
if let Some(max_t) = req.max_tokens {
|
||||
let char_limit = max_t * 4;
|
||||
if json_str.len() > char_limit {
|
||||
json_str.truncate(char_limit);
|
||||
let boundary = json_str.floor_char_boundary(char_limit);
|
||||
json_str.truncate(boundary);
|
||||
json_str.push_str(" ...[truncated due to max_tokens]");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user