Use the lowest zstd compression level during tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
303e8e1688
commit
ebecb6dad4
2 changed files with 10 additions and 4 deletions
|
@ -271,12 +271,19 @@ where
|
||||||
{
|
{
|
||||||
/// Write a given protobuf message to the stream.
|
/// Write a given protobuf message to the stream.
|
||||||
pub async fn write_message(&mut self, message: &Envelope) -> Result<(), WebSocketError> {
|
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.resize(message.encoded_len(), 0);
|
||||||
self.encoding_buffer.clear();
|
self.encoding_buffer.clear();
|
||||||
message
|
message
|
||||||
.encode(&mut self.encoding_buffer)
|
.encode(&mut self.encoding_buffer)
|
||||||
.map_err(|err| io::Error::from(err))?;
|
.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?;
|
self.stream.send(WebSocketMessage::Binary(buffer)).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ required-features = ["seed-support"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
collections = { path = "../collections" }
|
collections = { path = "../collections" }
|
||||||
rpc = { path = "../rpc" }
|
rpc = { path = "../rpc" }
|
||||||
|
|
||||||
anyhow = "1.0.40"
|
anyhow = "1.0.40"
|
||||||
async-std = { version = "1.8.0", features = ["attributes"] }
|
async-std = { version = "1.8.0", features = ["attributes"] }
|
||||||
async-trait = "0.1.50"
|
async-trait = "0.1.50"
|
||||||
|
@ -57,12 +56,12 @@ features = ["runtime-async-std-rustls", "postgres", "time", "uuid"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
collections = { path = "../collections", features = ["test-support"] }
|
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"] }
|
zed = { path = "../zed", features = ["test-support"] }
|
||||||
ctor = "0.1"
|
ctor = "0.1"
|
||||||
env_logger = "0.8"
|
env_logger = "0.8"
|
||||||
util = { path = "../util" }
|
util = { path = "../util" }
|
||||||
|
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue