diff --git a/nvim-core/src/lib.rs b/nvim-core/src/lib.rs index 61df4bc..17189a1 100644 --- a/nvim-core/src/lib.rs +++ b/nvim-core/src/lib.rs @@ -254,16 +254,13 @@ async fn get_nvim_connection() -> Result, String> { } _ => false, } => - { - match tokio::time::timeout( - tokio::time::Duration::from_secs(60), - read_half.read_buf(&mut resp_buf), - ) - .await - { - Ok(Ok(n)) if n > 0 => {} + match read_half.read_buf(&mut resp_buf).await { + Ok(n) if n > 0 => {} _ => { - tracing::error!("Neovim socket read loop closed or timeout"); + tracing::error!("Neovim socket read loop closed or EOF"); + // We need to clear the connection state so the next call reconnects + let mut conn = NVIM_CONN.lock().unwrap_or_else(|e| e.into_inner()); + *conn = None; break; } } @@ -372,7 +369,7 @@ async fn call_nvim(req: rmpv::Value) -> Result { .await .map_err(|_| "Failed to send request to Neovim connection manager")?; - match tokio::time::timeout(tokio::time::Duration::from_secs(10), reply_rx).await { + match tokio::time::timeout(tokio::time::Duration::from_secs(30), reply_rx).await { Ok(Ok(res)) => res, Ok(Err(_)) => Err("Response channel dropped".to_string()), Err(_) => Err("Timeout waiting for Neovim response".to_string()),