Add tokio-compat-02 for influxdb client

The HTTP client the influxdb client uses is still on tokio 0.2.
This commit is contained in:
Brian Tarricone 2021-08-29 00:55:48 -07:00
parent 525b5152ef
commit 7940d168fe
3 changed files with 31 additions and 0 deletions

27
Cargo.lock generated
View File

@ -1117,6 +1117,7 @@ dependencies = [
"serde", "serde",
"serde_yaml", "serde_yaml",
"tokio 1.10.1", "tokio 1.10.1",
"tokio-compat-02",
] ]
[[package]] [[package]]
@ -1934,6 +1935,7 @@ dependencies = [
"lazy_static", "lazy_static",
"memchr", "memchr",
"mio 0.6.23", "mio 0.6.23",
"num_cpus",
"pin-project-lite 0.1.11", "pin-project-lite 0.1.11",
"slab", "slab",
] ]
@ -1955,6 +1957,20 @@ dependencies = [
"winapi 0.3.9", "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]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "1.3.0" version = "1.3.0"
@ -1977,6 +1993,17 @@ dependencies = [
"webpki", "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]] [[package]]
name = "tokio-tls" name = "tokio-tls"
version = "0.3.1" version = "0.3.1"

View File

@ -17,3 +17,4 @@ rumqttc = "0.8"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_yaml = "0.8" serde_yaml = "0.8"
tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "rt", "rt-multi-thread"] } tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "rt", "rt-multi-thread"] }
tokio-compat-02 = "0.2"

View File

@ -153,9 +153,12 @@ async fn handle_publish(
}; };
query = query.add_tag(&tag.0, value); query = query.add_tag(&tag.0, value);
} }
use tokio_compat_02::FutureExt;
database database
.client .client
.query(&query) .query(&query)
.compat()
.await .await
.map_err(|err| format!("Failed to write to DB: {}", err))?; .map_err(|err| format!("Failed to write to DB: {}", err))?;
debug!("wrote to influx: {:?}", query); debug!("wrote to influx: {:?}", query);