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_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"

View File

@ -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"

View File

@ -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);