influxdb-rs/influxdb-rust

Tokio incompatibility

manio opened this issue · 8 comments

manio commented
  • Rust Version:
    rustc 1.50.0-nightly (f76ecd066 2020-12-15)
  • Runtime version (e.g. Tokio):
    tokio = { version = "0.3.5", features = ["full"] }
  • OS Version:
    linux x86_64

I have an above tokio in my project, then I've added the influxdb crate in my Cargo.toml:
influxdb = { version = "0.3.0", features = ["derive"] }

In my async task started from main I've added an example code for influxdb call and I have this:
thread 'tokio-runtime-worker' panicked at 'there is no reactor running, must be called from the context of Tokio runtime', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/io/driver/mod.rs:204:1

Is it a way to solve this besides making my project compatible for old tokio v2? Maybe you could update the tokio in your crate for 0.3 which is now a current version for the tokio crate?

I'd like to stick with my newest tokio but I also like to use the influxdb at the same time... is it possible?

manio commented

@blasrodri
I was not aware of this crate. Thank you for this tip!
Yay! it is not the cleanest way to do it but it works!!! :)

I leave this issue open. Please close if you feel this has been resolved.

What would you say is the cleanest way @manio?

manio commented

@Empty2k12 rewrite to use current Tokio v0.3 :)

@manio Now that tokio 1.0 is out we should rather use that?

manio commented

Oh.. definitely ;)

msrd0 commented

Given that our tokio version is basically dictated by the hyper version used by surf, which is still 0.13 (using tokio 0.2), there is little that this crate can do other than switching to another http client - do you know one that already updated?

However, for that, there's a couple of crate updates we need to await (pun intended).

surf depends on http-client which depends on hyper which depends on tokio. As soon as we're able to update, we should do it!