refactor: consolidate nvim crates, extract server library, and update workspace dependencies
This commit is contained in:
1 parent
a083719cf1
commit
533adfd41b
53 files changed
+5967
-1230
No files matched your search
+11
-9
@@ -70,7 +70,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok(req) => req,
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to parse target URL {}: {}", ws_url, e);
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(250)).await;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
@@ -126,9 +126,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
if text.len() > 1000 { "..." } else { "" }
|
||||
);
|
||||
use tokio::io::AsyncWriteExt;
|
||||
let mut payload = Vec::with_capacity(text.len() + 1);
|
||||
payload.extend_from_slice(text.as_bytes());
|
||||
payload.push(b'\n');
|
||||
let mut stdout = tokio::io::stdout();
|
||||
let response = format!("{}\n", text);
|
||||
let _ = stdout.write_all(response.as_bytes()).await;
|
||||
let _ = stdout.write_all(&payload).await;
|
||||
let _ = stdout.flush().await;
|
||||
}
|
||||
}
|
||||
@@ -151,30 +153,30 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
send_task.abort();
|
||||
}
|
||||
}
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(250)).await;
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
tracing::error!("Failed to connect via WSS: {}", e);
|
||||
retry_count += 1;
|
||||
if retry_count >= 5 {
|
||||
if retry_count >= 20 {
|
||||
tracing::error!("Max connection retries reached. Exiting proxy.");
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(250)).await;
|
||||
}
|
||||
Err(_) => {
|
||||
tracing::error!("Connection attempt timed out");
|
||||
retry_count += 1;
|
||||
if retry_count >= 5 {
|
||||
if retry_count >= 20 {
|
||||
tracing::error!("Max connection retries reached. Exiting proxy.");
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(250)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if retry_count >= 5 {
|
||||
if retry_count >= 20 {
|
||||
return Err("Failed to connect to the MCP memory server after multiple attempts. Is it running?".into());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user