Avoid duplicate cargo checks

This commit is contained in:
Aleksey Kladov 2021-04-06 12:40:31 +03:00
parent 9ca59733e3
commit 3698b3eab8

View File

@ -2,6 +2,7 @@
//! requests/replies and notifications back to the client.
use std::{
env, fmt,
sync::Arc,
time::{Duration, Instant},
};
@ -229,17 +230,23 @@ fn handle_event(&mut self, event: Event) -> Result<()> {
}
ProjectWorkspaceProgress::End(workspaces) => {
self.fetch_workspaces_completed(workspaces);
let old = Arc::clone(&self.workspaces);
self.switch_workspaces();
if self.config.run_build_scripts() {
let workspaces_updated = !Arc::ptr_eq(&old, &self.workspaces);
if self.config.run_build_scripts() && workspaces_updated {
let mut collector = BuildDataCollector::default();
for ws in self.workspaces.iter() {
ws.collect_build_data_configs(&mut collector);
}
self.fetch_build_data_request(collector)
}
(Progress::End, None)
}
};
self.report_progress("fetching", state, msg, None);
}
Task::FetchBuildData(progress) => {
@ -250,15 +257,19 @@ fn handle_event(&mut self, event: Event) -> Result<()> {
}
BuildDataProgress::End(build_data_result) => {
self.fetch_build_data_completed(build_data_result);
self.switch_workspaces();
(Some(Progress::End), None)
}
};
if let Some(state) = state {
self.report_progress("loading", state, msg, None);
}
}
}
// Coalesce multiple task events into one loop turn
task = match self.task_pool.receiver.try_recv() {
Ok(task) => task,