Skip to content
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

Auto-detect existing tokio runtime? #491

Open
TheBlueMatt opened this issue Mar 17, 2025 · 1 comment
Open

Auto-detect existing tokio runtime? #491

TheBlueMatt opened this issue Mar 17, 2025 · 1 comment
Milestone

Comments

@TheBlueMatt
Copy link

When building, we could ask https://docs.rs/tokio/latest/tokio/runtime/struct.Handle.html#method.try_current if we're already in a runtime and use that, which would be nice. Sadly an outer library can't do that because they only get a Handle, not an Arc<Runtime>.

@tnull
Copy link
Collaborator

tnull commented Mar 18, 2025

Yeah, I think historically we couldn't use Handle as we wanted to call Runtime::shutdown_timeout on Node::stop. However, by now we realized that the latter doesn't play well with taking an outer runtime anyways (as we'd need to own Runtime for it), and shutdown_timeout doesn't work the way you'd expect it to anyways.

TLDR: I think by now we could explore whether we can switch to use Handle everywhere, which would indeed allow us to auto-detect the outer runtime.

@tnull tnull added this to the 0.6 milestone Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants