-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ntex runtime panic #335
Comments
I quickly look into pr. I don't really understand how shuttle work. technically, ntex should be similar to Actix, but I am not sure how Actix works nowadays. as I remember Actix team decided tight connect Actix and Tokio, on other hand ntex is as neutral as possible, so you might need to construct Tokio runtime via ntex. unfortunately, I don't have much free time to invest |
Just one question, when you say "construct Tokio runtime" could you explain a bit more what you mean? I am just trying to identify the root cause so that I can resolve it :) |
someone needs to construct tokio runtime, i dont see this in your pr. all async operations must run from within |
Line 170 in 395cf69
|
Cool thank you very much for your time and insights. I will try to look deeper into it! |
@fafhrd91 I have given it a try but apparently since I can get an access to Shuttle's runtime with |
you can try to modify System builder and allow to run it with tokio’s Handler |
Also from what I have been reading about Actix's similar documentation, the behaviour between Ntex and Actix looks similar, regarding |
You mean by submitting a PR to Ntex to add that feature, right? |
right, but just for tokio feature. i dont want to depend on tokio in mid term |
Ok got it, I will give it a try but since I am new to Rust, I might struggle a bit 😄 |
use |
Amazing! Thank you very much @fafhrd91 ❤️ |
@fafhrd91 I cannot find the |
this method available only for tokio feature, probably docs gen params needs to be adjusted |
@fafhrd91 Thanks! How can we run async jobs in the background? I have tried System::new("scheduler")
.system()
.arbiter()
.spawn(Box::pin(async move {
loop {
scheduler.tick().await;
// Cannot use `std::thread::sleep` because it blocks the Tokio runtime.
time::sleep(scheduler.time_till_next_job()).await;
}
})); But it does not work as expected. The code is from our integration with ntex. |
ntex_rt::spawn(some_fut) |
It returns an error:
|
you have to pass System::current() from block_on. and the use System::arbiter().spawn() here is example Line 27 in c60e7f5
|
Hello, I have opened a PR on Shuttle where I am trying to provide an integration with the Ntex framework. Unfortunately there is a runtime error when we are running the basic example.
The relevant PR is: shuttle-hq/shuttle#1707
Are there any indications on what I might be doing wrong?
Thank you in advance!
The text was updated successfully, but these errors were encountered: