Don't use block_on in jobs.finish(), we can .await

pull/1622/head
Blaž Hrastnik 3 years ago
parent d3221b03a2
commit 6ea477ab60

@ -222,7 +222,6 @@ impl Application {
loop { loop {
if self.editor.should_close() { if self.editor.should_close() {
self.jobs.finish();
break; break;
} }
@ -666,6 +665,8 @@ impl Application {
self.event_loop().await; self.event_loop().await;
self.jobs.finish().await;
if self.editor.close_language_servers(None).await.is_err() { if self.editor.close_language_servers(None).await.is_err() {
log::error!("Timed out waiting for language servers to shutdown"); log::error!("Timed out waiting for language servers to shutdown");
}; };

@ -93,8 +93,8 @@ impl Jobs {
} }
/// Blocks until all the jobs that need to be waited on are done. /// Blocks until all the jobs that need to be waited on are done.
pub fn finish(&mut self) { pub async fn finish(&mut self) {
let wait_futures = std::mem::take(&mut self.wait_futures); let wait_futures = std::mem::take(&mut self.wait_futures);
helix_lsp::block_on(wait_futures.for_each(|_| future::ready(()))); wait_futures.for_each(|_| future::ready(())).await
} }
} }

Loading…
Cancel
Save