From 7940d168fe029a77a13ef1d586beae31a5c794d8 Mon Sep 17 00:00:00 2001 From: "Brian J. Tarricone" Date: Sun, 29 Aug 2021 00:55:48 -0700 Subject: [PATCH] Add tokio-compat-02 for influxdb client The HTTP client the influxdb client uses is still on tokio 0.2. --- Cargo.lock | 27 +++++++++++++++++++++++++++ Cargo.toml | 1 + src/main.rs | 3 +++ 3 files changed, 31 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a8a646a..9bee6a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1117,6 +1117,7 @@ dependencies = [ "serde", "serde_yaml", "tokio 1.10.1", + "tokio-compat-02", ] [[package]] @@ -1934,6 +1935,7 @@ dependencies = [ "lazy_static", "memchr", "mio 0.6.23", + "num_cpus", "pin-project-lite 0.1.11", "slab", ] @@ -1955,6 +1957,20 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "tokio-compat-02" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d4237822b7be8fff0a7a27927462fad435dcb6650f95cea9e946bf6bdc7e07" +dependencies = [ + "bytes 0.5.6", + "once_cell", + "pin-project-lite 0.2.0", + "tokio 0.2.23", + "tokio 1.10.1", + "tokio-stream", +] + [[package]] name = "tokio-macros" version = "1.3.0" @@ -1977,6 +1993,17 @@ dependencies = [ "webpki", ] +[[package]] +name = "tokio-stream" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.0", + "tokio 1.10.1", +] + [[package]] name = "tokio-tls" version = "0.3.1" diff --git a/Cargo.toml b/Cargo.toml index 5cc093b..f63baf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,4 @@ rumqttc = "0.8" serde = { version = "1", features = ["derive"] } serde_yaml = "0.8" tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "rt", "rt-multi-thread"] } +tokio-compat-02 = "0.2" diff --git a/src/main.rs b/src/main.rs index 1d54a20..cecbd48 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,9 +153,12 @@ async fn handle_publish( }; query = query.add_tag(&tag.0, value); } + + use tokio_compat_02::FutureExt; database .client .query(&query) + .compat() .await .map_err(|err| format!("Failed to write to DB: {}", err))?; debug!("wrote to influx: {:?}", query);