Don't starve main thread when lots of messages/events arrive at once
This commit is contained in:
parent
7a454003fe
commit
18b1e9d35f
2 changed files with 6 additions and 0 deletions
|
@ -631,6 +631,9 @@ impl Client {
|
||||||
} else {
|
} else {
|
||||||
log::info!("unhandled message {}", type_name);
|
log::info!("unhandled message {}", type_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't starve the main thread when receiving lots of messages at once.
|
||||||
|
smol::future::yield_now().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1278,6 +1278,9 @@ impl Project {
|
||||||
this.update(&mut cx, |this, cx| {
|
this.update(&mut cx, |this, cx| {
|
||||||
this.on_lsp_event(server_id, event, &language, cx)
|
this.on_lsp_event(server_id, event, &language, cx)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Don't starve the main thread when lots of events arrive all at once.
|
||||||
|
smol::future::yield_now().await;
|
||||||
}
|
}
|
||||||
Some(())
|
Some(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue