Optimize graph relation filtering and fix concurrent connection storms

This commit is contained in:
Riz Ashraf committed 2026-09-21 05:44:34 +01:00
1 parent cbd3d5801c
commit ed42f738f1
2 files changed
+6 -21

No files matched your search

+4 -8
View File
@@ -126,12 +126,10 @@ pub struct NvimRequest {
static NVIM_CONN: LazyLock<Arc<Mutex<Option<mpsc::Sender<NvimRequest>>>>> = LazyLock::new(|| Arc::new(Mutex::new(None)));
async fn get_nvim_connection() -> Result<mpsc::Sender<NvimRequest>, String> {
{
let conn_lock = NVIM_CONN.lock().await;
if let Some(sender) = conn_lock.as_ref() {
if !sender.is_closed() {
return Ok(sender.clone());
}
let mut conn_lock = NVIM_CONN.lock().await;
if let Some(sender) = conn_lock.as_ref() {
if !sender.is_closed() {
return Ok(sender.clone());
}
}
@@ -243,7 +241,6 @@ async fn get_nvim_connection() -> Result<mpsc::Sender<NvimRequest>, String> {
}
});
let mut conn_lock = NVIM_CONN.lock().await;
*conn_lock = Some(tx.clone());
Ok(tx)
}
@@ -1004,7 +1001,6 @@ fn init_logging(app_name: &str) -> tracing_appender::non_blocking::WorkerGuard {
mod tests {
use super::*;
use tokio::io::BufReader;
use tokio::io::AsyncReadExt;
#[test]
fn test_rmpv_to_json_primitives() {