Add support for external Tokio runtimes in TokioAdapter#665
Add support for external Tokio runtimes in TokioAdapter#665riederm wants to merge 2 commits intocberner:masterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34c26c01cd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| pub fn with_runtime(inner: T, runtime_handle: tokio::runtime::Handle) -> Self { | ||
| Self { | ||
| inner: Arc::new(inner), | ||
| runtime: Runtime::External(runtime_handle), |
There was a problem hiding this comment.
Keep the external Tokio runtime alive for the mount
TokioAdapter::with_runtime stores only a tokio::runtime::Handle, which can spawn onto a runtime but does not own it. That means a caller can mount successfully and still end up with an adapter whose executor disappears as soon as the original Runtime value is dropped or shut down—for example with spawn_mount(...) after setup code exits, or with a temporary Runtime::new()?.handle().clone(). In that state new FUSE requests are still accepted, but there is no longer a guaranteed live executor to run the async handlers, so the mount can stop servicing operations unexpectedly.
Useful? React with 👍 / 👎.
Adds a second constructor
TokioAdapter::with_runtimeto allow touse an already instantiated tokio runtime rather than creating a
new one.