diff options
author | Blaž Hrastnik | 2021-01-06 08:48:14 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-01-06 08:48:14 +0000 |
commit | 941c34a7fc86e613b41887174c699be52ab202a8 (patch) | |
tree | 36bdaf9f2ac4ff19e01ba4588639785e5093999b /helix-lsp/src | |
parent | b2800489dedb44cf030cd425d737ea14491518aa (diff) |
lsp: Move timeouts into client.request
Diffstat (limited to 'helix-lsp/src')
-rw-r--r-- | helix-lsp/src/client.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 207e2970..e3f72a56 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -114,7 +114,14 @@ impl Client { .await .map_err(|e| Error::Other(e.into()))?; - let response = rx.recv().await.map_err(|e| Error::Other(e.into()))??; + use smol_timeout::TimeoutExt; + use std::time::Duration; + + let response = match rx.recv().timeout(Duration::from_secs(2)).await { + Some(response) => response, + None => return Err(Error::Timeout), + } + .map_err(|e| Error::Other(e.into()))??; let response = serde_json::from_value(response)?; |