diff --git a/crates/rpc/src/proto.rs b/crates/rpc/src/proto.rs index 6352c466c94e24f35946c262fd6bfa4e18bf23a5..8093f2551fc4fbb380f64f20dff219c6b2ca5927 100644 --- a/crates/rpc/src/proto.rs +++ b/crates/rpc/src/proto.rs @@ -271,12 +271,19 @@ where { /// Write a given protobuf message to the stream. pub async fn write_message(&mut self, message: &Envelope) -> Result<(), WebSocketError> { + #[cfg(any(test, feature = "test-support"))] + const COMPRESSION_LEVEL: i32 = -7; + + #[cfg(not(any(test, feature = "test-support")))] + const COMPRESSION_LEVEL: i32 = 4; + self.encoding_buffer.resize(message.encoded_len(), 0); self.encoding_buffer.clear(); message .encode(&mut self.encoding_buffer) .map_err(|err| io::Error::from(err))?; - let buffer = zstd::stream::encode_all(self.encoding_buffer.as_slice(), 4).unwrap(); + let buffer = + zstd::stream::encode_all(self.encoding_buffer.as_slice(), COMPRESSION_LEVEL).unwrap(); self.stream.send(WebSocketMessage::Binary(buffer)).await?; Ok(()) } diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index a4357415da4c9014fe5aad6f6ba19181b178c587..38aeac8a6b0a1d82ad9b2f3bf0e8a8f04cc74ceb 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -15,7 +15,6 @@ required-features = ["seed-support"] [dependencies] collections = { path = "../collections" } rpc = { path = "../rpc" } - anyhow = "1.0.40" async-std = { version = "1.8.0", features = ["attributes"] } async-trait = "0.1.50" @@ -57,12 +56,12 @@ features = ["runtime-async-std-rustls", "postgres", "time", "uuid"] [dev-dependencies] collections = { path = "../collections", features = ["test-support"] } -gpui = { path = "../gpui" } +gpui = { path = "../gpui", features = ["test-support"] } +rpc = { path = "../rpc", features = ["test-support"] } zed = { path = "../zed", features = ["test-support"] } ctor = "0.1" env_logger = "0.8" util = { path = "../util" } - lazy_static = "1.4" serde_json = { version = "1.0.64", features = ["preserve_order"] }