Skip to content

Commit

Permalink
Merge pull request #223 from MordechaiHadad/fix/high-cpu
Browse files Browse the repository at this point in the history
Fix: high cpu usage when using neovim proxy
  • Loading branch information
MordechaiHadad authored Jun 14, 2024
2 parents 7b856cd + f6ad36f commit fb72df2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/helpers/processes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use crate::config::Config;
use anyhow::{anyhow, Result};
use std::sync::{atomic::AtomicBool, Arc};
use tokio::process::Command;
use std::{
sync::{atomic::AtomicBool, Arc},
time::Duration,
};
use tokio::{process::Command, time::sleep};

use super::{
directories, get_platform_name,
Expand Down Expand Up @@ -133,6 +136,8 @@ pub async fn handle_nvim_process(config: &Config, args: &[String]) -> Result<()>
_term.store(false, Ordering::Relaxed);
}
}
// short delay to a void high cpu usage
sleep(Duration::from_millis(200)).await;
}
Err(_) => return Err(anyhow!("Failed to wait on child process")),
}
Expand Down

0 comments on commit fb72df2

Please sign in to comment.