Closed pavlospt closed 2 months ago
as I remember you can use Handle::new() instead of actual handle.
as I remember you can use Handle::new() instead of actual handle.
I wasn't able to find a Handle::new()
🤔
https://docs.rs/tokio/latest/tokio/runtime/struct.Handle.html#method.current
Indeed ::current()
is what I use in tests. Maybe you mean something else?
use current(), and something like use_current_handle: bool in builder
I have some tests that take longer than 60s on Ntex-rt and they fail with timeout. I believe I have reached the peak of my understanding of how the underlying system works here 😛 If you have more hints or advice let me know :D
add env_logger::init() to your test and try to run it with RUST_LOG=trace
I have tried that and also tried debugging it. It seems that the other test is panicking because it cannot find a configured runtime and panics at: lib.rs#353
. I am not sure how to enable tokio
feature for this test and I am out of ideas :/
default behavior must be same as before, running with handler must be enabled explicitly
But if this is not enabled with a Cargo feature then how am I going to import Handle
🤔 ?
you can use try_current(), if it returns error then switch to old behavior
Handle
though resides in tokio
crate. So if tokio
feature is not enabled then how will the library compile when it needs to
use tok_io::runtime::Handle;
🤔
mark import with feature or move it inside block that already marked with feature
Ok I am now thinking this issue is above my skills with the language 😛 Thank for your time and your explanations though 🙏🏻
I will take check what I can do next weekend
here is example how to use tokio https://github.com/ntex-rs/examples/blob/1a365350df3a9c904da5fbaa3b1e479fdb9191da/tokio/src/main.rs#L77
idea is right, but I would make "handle: Option", and added ".new_with_handle(..)" methods.