Fix the endless progress bar issue

This commit is contained in:
Kirill Bulatov 2020-03-30 14:38:01 +03:00
parent 8e78371222
commit 4c897d8d2d

View file

@ -95,6 +95,9 @@ impl CheckWatcherThread {
}
fn run(&mut self, task_send: &Sender<CheckTask>, cmd_recv: &Receiver<CheckCommand>) {
// If we rerun the thread, we need to discard the previous check results first
self.clean_previous_results(task_send);
loop {
select! {
recv(&cmd_recv) -> cmd => match cmd {
@ -127,6 +130,13 @@ impl CheckWatcherThread {
}
}
fn clean_previous_results(&self, task_send: &Sender<CheckTask>) {
task_send.send(CheckTask::ClearDiagnostics).unwrap();
task_send
.send(CheckTask::Status(WorkDoneProgress::End(WorkDoneProgressEnd { message: None })))
.unwrap();
}
fn should_recheck(&mut self) -> bool {
if let Some(_last_update_req) = &self.last_update_req {
// We currently only request an update on save, as we need up to