From 07d59c84072dfd22082514a9ad9b346979e98b24 Mon Sep 17 00:00:00 2001 From: Ruslan Pislari Date: Wed, 16 Oct 2024 13:08:39 +0300 Subject: [PATCH] refactor: drop async from write_stats method --- Cargo.lock | 43 ++++++++++---------------------- crates/http-service/Cargo.toml | 2 +- crates/http-service/src/lib.rs | 6 ++--- crates/runtime/Cargo.toml | 2 +- crates/runtime/src/util/stats.rs | 2 +- src/main.rs | 2 +- 6 files changed, 20 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15aeb2a..e2d9058 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -440,6 +440,12 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "cityhash-rs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93a719913643003b84bd13022b4b7e703c09342cd03b679c4641c7d2e50dc34d" + [[package]] name = "claims" version = "0.7.1" @@ -517,20 +523,20 @@ dependencies = [ [[package]] name = "clickhouse" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9136d34663bf9964914b5cea6cd126d2b35da8a60ec798c615214679e13e48d9" +checksum = "cbbda6a46e0d129d51a808b75e92c209d45313d506dc1734811ca51b4d671f9d" dependencies = [ "bstr", "bytes", + "cityhash-rs", "clickhouse-derive", - "clickhouse-rs-cityhash-sys", "futures", "futures-channel", "http-body-util", "hyper 1.4.1", "hyper-util", - "lz4", + "lz4_flex", "replace_with", "sealed", "serde", @@ -552,15 +558,6 @@ dependencies = [ "syn", ] -[[package]] -name = "clickhouse-rs-cityhash-sys" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4baf9d4700a28d6cb600e17ed6ae2b43298a5245f1f76b4eab63027ebfd592b9" -dependencies = [ - "cc", -] - [[package]] name = "colorchoice" version = "1.0.2" @@ -1755,24 +1752,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] -name = "lz4" -version = "1.26.0" +name = "lz4_flex" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958b4caa893816eea05507c20cfe47574a43d9a697138a7872990bba8a0ece68" -dependencies = [ - "libc", - "lz4-sys", -] - -[[package]] -name = "lz4-sys" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" -dependencies = [ - "cc", - "libc", -] +checksum = "75761162ae2b0e580d7e7c390558127e5f01b4194debd6221fd8c207fc80e3f5" [[package]] name = "mach2" diff --git a/crates/http-service/Cargo.toml b/crates/http-service/Cargo.toml index 4bfc669..9d27132 100644 --- a/crates/http-service/Cargo.toml +++ b/crates/http-service/Cargo.toml @@ -32,7 +32,7 @@ futures = "0.3.30" once_cell = "1.19" prometheus = { version = "0.13.3", features = ["process"], optional = true } serde = "1.0" -clickhouse = { version = "0.12.0", optional = true } +clickhouse = { version = "0.13", optional = true } chrono = "0.4" async-trait = "0.1" wasmtime-wasi-http = "20.0.2" diff --git a/crates/http-service/src/lib.rs b/crates/http-service/src/lib.rs index ea55b7c..59b16d5 100644 --- a/crates/http-service/src/lib.rs +++ b/crates/http-service/src/lib.rs @@ -302,7 +302,7 @@ where request_id: request_id.to_string(), ..Default::default() }; - self.context.write_stats(stat_row).await; + self.context.write_stats(stat_row); } #[cfg(feature = "metrics")] metrics::metrics( @@ -407,7 +407,7 @@ where request_id: request_id.to_string(), ..Default::default() }; - self.context.write_stats(stat_row).await; + self.context.write_stats(stat_row); } #[cfg(not(feature = "stats"))] tracing::debug!(?fail_reason, request_id, "stats"); @@ -637,7 +637,7 @@ mod tests { } impl StatsWriter for TestContext { - async fn write_stats(&self, _stat: StatRow) {} + fn write_stats(&self, _stat: StatRow) {} } impl Router for TestContext { diff --git a/crates/runtime/Cargo.toml b/crates/runtime/Cargo.toml index 433f40c..22c0253 100644 --- a/crates/runtime/Cargo.toml +++ b/crates/runtime/Cargo.toml @@ -34,7 +34,7 @@ serde = "1.0" serde_json = "1.0.108" chrono = { version = "0.4", features = ["serde"] } prometheus = { version = "0.13.3", features = ["process"], optional = true } -clickhouse = { version = "0.12.0", optional = true } +clickhouse = { version = "0.13", optional = true } lazy_static = { version = "1.4.0", optional = true } wasmtime-wasi-http = "20.0.2" diff --git a/crates/runtime/src/util/stats.rs b/crates/runtime/src/util/stats.rs index c5ec556..74817f1 100644 --- a/crates/runtime/src/util/stats.rs +++ b/crates/runtime/src/util/stats.rs @@ -24,5 +24,5 @@ pub struct StatRow { pub struct StatRow; pub trait StatsWriter { - fn write_stats(&self, stat: StatRow) -> impl std::future::Future + Send; + fn write_stats(&self, stat: StatRow); } diff --git a/src/main.rs b/src/main.rs index add5814..c97b00a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -300,7 +300,7 @@ impl Router for CliContext { } impl StatsWriter for CliContext { - async fn write_stats(&self, _stat: StatRow) {} + fn write_stats(&self, _stat: StatRow) {} } fn parse_key_value(