fix(mcp-memory,nvim-core): eliminate lock contention in get_nvim_connection and resolve CPU bound loop in graph.rs

This commit is contained in:
Riz Ashraf committed 2026-10-11 18:21:58 +01:00
1 parent e91b53fdcc
commit 0afba74b4c
2 files changed
+104 -102

No files matched your search

+4 -3
View File
@@ -391,6 +391,8 @@ fn handle_nvim_notification(params: &[rmpv::Value]) {
}
async fn get_nvim_connection() -> Result<mpsc::Sender<NvimRequest>, String> {
let target_socket = read_active_socket_file().await.unwrap_or_default();
// Fast path: If NVIM_CONN is already active and healthy, check if active_nvim.txt matches
// without spawning any external nvim.exe child process!
{
@@ -400,9 +402,8 @@ async fn get_nvim_connection() -> Result<mpsc::Sender<NvimRequest>, String> {
{
let active_lock = ACTIVE_SOCKET.lock().await;
if let Some(ref current_socket) = *active_lock
&& let Ok(target) = read_active_socket_file().await
&& !target.is_empty()
&& &target == current_socket
&& !target_socket.is_empty()
&& &target_socket == current_socket
{
return Ok(sender.clone());
}