mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Introduce a timeout when processing incoming messages
We have an hypothesis that the server gets stuck while processing an incoming message, either because the buffer fills up or because a handler never completes. This should mitigate that and, once we add logging, give us some clue as to what is causing it exactly. Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
0b1fda3e13
commit
53a7f9c43e
@ -175,8 +175,10 @@ impl Peer {
|
|||||||
let incoming = incoming.context("received invalid RPC message")?;
|
let incoming = incoming.context("received invalid RPC message")?;
|
||||||
receive_timeout.set(create_timer(RECEIVE_TIMEOUT).fuse());
|
receive_timeout.set(create_timer(RECEIVE_TIMEOUT).fuse());
|
||||||
if let proto::Message::Envelope(incoming) = incoming {
|
if let proto::Message::Envelope(incoming) = incoming {
|
||||||
if incoming_tx.send(incoming).await.is_err() {
|
match incoming_tx.send(incoming).timeout(RECEIVE_TIMEOUT).await {
|
||||||
return Ok(());
|
Some(Ok(_)) => {},
|
||||||
|
Some(Err(_)) => return Ok(()),
|
||||||
|
None => Err(anyhow!("timed out processing incoming message"))?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user