Get chat integration tests passing

* Don't send a chat message before the previous chat message
  is acknowledged.
* Fix emitting of notifications in RPC server

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-02-14 12:37:17 -08:00
parent bf6ae0d8f8
commit 7b666af0cf
2 changed files with 10 additions and 3 deletions

View file

@ -191,16 +191,17 @@ impl Server {
log::info!("rpc message received. connection:{}, type:{}", connection_id, type_name);
if let Some(handler) = this.handlers.get(&message.payload_type_id()) {
let handle_message = (handler)(this.clone(), message);
let notifications = this.notifications.clone();
executor.spawn_detached(async move {
if let Err(err) = handle_message.await {
log::error!("rpc message error. connection:{}, type:{}, error:{:?}", connection_id, type_name, err);
} else {
log::info!("rpc message handled. connection:{}, type:{}, duration:{:?}", connection_id, type_name, start_time.elapsed());
}
if let Some(mut notifications) = notifications {
let _ = notifications.send(()).await;
}
});
if let Some(mut notifications) = this.notifications.clone() {
let _ = notifications.send(()).await;
}
} else {
log::warn!("unhandled message: {}", type_name);
}