Closed Lucyfurnice closed 1 year ago
I did find that mongo-rust-driver
is using tokio version = "1.17.0"
I guess that would be the problem
C:\Repositories\git.debased.earth\zhb\cassius>.\target\debug\cassius.exe thread 'main' panicked at 'there is no timer running, must be called from the context of a Tokio 0.2.x runtime', C:\Users\Lucyfurnice\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-0.2.25\src\time\driver\handle.rs:24:32 stack backtrace: ...
I think my feature flags could be conflicting let me try to compile the tutorial.
cargo new mongotest cd mongotest cargo add tokio --features full cargo add wither --features tokio-runtime cargo add futures cargo add serde
https://github.com/thedodd/wither/blob/master/wither/examples/readme.rs as the source in main.rs
cargo build .\target\debug\mongotest.exe
thread 'main' panicked at 'there is no timer running, must be called from the context of a Tokio 0.2.x runtime', C:\Users\Lucyfurnice.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-0.2.25\src\time\driver\handle.rs:24:32
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library\std\src\panicking.rs:575
1: core::panicking::panic_fmt
at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library\core\src\panicking.rs:64
2: core::panicking::panic_display<ref$<str$> >
at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library\core\src\panicking.rs:147
3: core::panicking::panic_str
at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library\core\src\panicking.rs:131
4: core::option::expect_failed
at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library\core\src\option.rs:1924
5: enum2$<core::option::OptionRUST_BACKTRACE=full
for a verbose backtrace.
Switching tokio to version "0.2.25" works. Wonder what is using that version...
fixed with cargo add --git [this repo]
When I include code in my main that syncs a model, or within a function that main calls, I get a huge stacktrace.
thread 'main' panicked at 'there is no timer running, must be called from the context of a Tokio 0.2.x runtime'...
I see there is an old issue on mongodb-rust-driver but i could not try because of version changes.main
async fn main() -> Result<(), Box> {
...
let db_client:Client = create_db_client().await.unwrap();
let db:Database = db_client.database("name");
Topic::sync(db).await;
...
}
Cargo.toml
[dependencies] clap = { version = "4.2.1", features = ["derive"] } clokwerk = "0.4.0" dptree = "0.3.0" fern = { version = "0.6.2", features = ["date-based", "chrono", "colored"] } futures = "0.3.28" humantime = "2.1.0" log = { version = "0.4.17", features = ["serde"] } reqwest = { version = "0.11.16", features = ["tokio-socks", "serde_json", "json", "gzip", "deflate", "cookies", "cookie_store"] } rss = { version = "2.0.3", features = ["serde", "chrono", "atom", "with-serde", "validation"] } selectors = { version = "0.24.0", features= [] } serde = { version = "1.0.159", features = ["derive"] } serde_json = { version = "1.0.95", features = ["preserve_order"] } teloxide = { version = "0.12.2", features = ["webhooks", "macros", "throttle", "sqlite-storage"] } tokio = { version = "1.27.0", features = ["bytes", "net", "rt-multi-thread", "time", "process", "macros", "sync", "signal", "fs", "windows-sys", "stats", "io-std", "io-util"] } wither = { version = "0.9.0" , features = [] }