mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
Use a deadline when eagerly processing notifications
This commit is contained in:
parent
503ca112ae
commit
f2d8ce3415
@ -159,9 +159,16 @@ pub async fn event_loop(&mut self) {
|
||||
}
|
||||
Some((id, call)) = self.editor.language_servers.incoming.next() => {
|
||||
self.handle_language_server_message(call, id).await;
|
||||
|
||||
// eagerly process any other available notifications/calls
|
||||
let now = std::time::Instant::now();
|
||||
let deadline = std::time::Duration::from_millis(10);
|
||||
while let Some(Some((id, call))) = self.editor.language_servers.incoming.next().now_or_never() {
|
||||
self.handle_language_server_message(call, id).await;
|
||||
|
||||
if now.elapsed() > deadline { // use a deadline so we don't block too long
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.render();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user