Closed mocchira closed 2 months ago
There may be some value in making it more general
How would you feel about an into_tokio_runtime
that consumes the self and returns the runtime instead?
You could still use shutdown_background but it would not tie down other possible use-cases
There may be some value in making it more general How would you feel about an into_tokio_runtime that consumes the self and returns the runtime instead? You could still use shutdown_background but it would not tie down other possible use-cases
Sounds good! I will update the PR as suggested.
I'd also prefer your function return the Option
instead of unwrapping
Is this still something you are interested in?
Sorry for the late reply. Now I'm tackling the problem that using rustyscript on tonic doesn't work as expected sometimes. This PR is one of the fix to make it however it has gradually turned out that running rustyscript on tonic's tokio runtime can cause some trouble so I gonna try to use WorkerPlool.
What're the issues you encountered? It may be helpful for yourself and others in the same position if you open a discussion post detailing the problem
In the meantime, given how trivial this change is I will close this pr for now and add an into_tokio_runtime
or something in the version being released tomorrow
What're the issues you encountered? It may be helpful for yourself and others in the same position if you open a discussion post detailing the problem
After get the point, I'll open a discussion post:)
As described at a comment included in this PR, Now library users are not able to call tokio runtime's shutdown_background because it's wrapped by Rc.
There are some use cases for users to call
shutdown_background
from within another tokio runtime like using withtonic
so IMHO addingshutdown_background_tokio_runtime
looks reasonable.