fix: CPU usage after launching a cluster
This commit is contained in:
parent
24f58bec2d
commit
451987a326
3 changed files with 12 additions and 17 deletions
|
|
@ -70,8 +70,6 @@ pub async fn run_app<F: FnOnce(&tauri::AppHandle<tauri::Wry>) + Send + 'static>(
|
|||
.manage(ext::updater::State::default())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
// TODO: add back tauri-plugin-window-state -- it's buggy at the moment
|
||||
// .plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.plugin(api::init())
|
||||
.menu(tauri::menu::Menu::new)
|
||||
.invoke_handler(prebuild.invoke_handler())
|
||||
|
|
|
|||
|
|
@ -750,8 +750,7 @@ impl Clusters {
|
|||
pub fn sync_cluster(cluster_path: ClusterPath) {
|
||||
tokio::task::spawn(async move {
|
||||
let span = tracing::span!(tracing::Level::INFO, "sync_cluster");
|
||||
let res = async {
|
||||
let _span = span.enter();
|
||||
let res = span.in_scope(|| async {
|
||||
let state = State::get().await?;
|
||||
let dirs = &state.directories;
|
||||
let mut clusters = state.clusters.write().await;
|
||||
|
|
@ -781,7 +780,7 @@ impl Clusters {
|
|||
});
|
||||
}
|
||||
Ok::<(), crate::Error>(())
|
||||
}
|
||||
})
|
||||
.await;
|
||||
|
||||
match res {
|
||||
|
|
|
|||
|
|
@ -438,22 +438,20 @@ impl Processor {
|
|||
let mut stdout = BufReader::new(stdout).lines();
|
||||
let mut stderr = BufReader::new(stderr).lines();
|
||||
|
||||
while let Ok(line) = tokio::select! {
|
||||
while let Ok(Some(line)) = tokio::select! {
|
||||
line = stdout.next_line() => line,
|
||||
line = stderr.next_line() => line,
|
||||
} {
|
||||
if let Some(line) = line {
|
||||
let mut censored = line.clone();
|
||||
for (key, value) in &censors {
|
||||
censored = censored.replace(key, value);
|
||||
}
|
||||
|
||||
if let Err(err) =
|
||||
send_process(uuid, pid, ProcessPayloadType::Logging, &censored).await
|
||||
{
|
||||
tracing::warn!("failed to send process log: {}", err);
|
||||
};
|
||||
let mut censored = line.clone();
|
||||
for (key, value) in &censors {
|
||||
censored = censored.replace(key, value);
|
||||
}
|
||||
|
||||
if let Err(err) =
|
||||
send_process(uuid, pid, ProcessPayloadType::Logging, &censored).await
|
||||
{
|
||||
tracing::warn!("failed to send process log: {}", err);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue