Repository navigation
refactor(message)!: expose spawned task handles - #114
Merged
Merged
Conversation
This was referenced Sep 14, 2026
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Messager::spawnpreviously accepted only unit-output messages and discarded Tokio's task handle. It now returnsJoinHandle<M::Output>, allowing callers to await values or application errors, observe panics/cancellation throughJoinError, and abort work. The implementation returns the handle from the existingtokio::spawncall without adding another task or allocation.Keep
Message/Messageras an optional typed-command convention with application context. Document thatsendexecutes in the caller's future, while spawned tasks require caller-managed lifetimes. Update the README, compile-checked API example, runnable message example, and migration guide to match.Compatibility: calls with a semicolon still compile; code expecting
spawnto return()must adapt. Dropping a handle still detaches its task, including when the owning future is cancelled. Spawned messages are not automatically joined by application shutdown; awaitingsendinside an owned scheduled execution keeps that work within the scheduler's existing lifetime.Validation:
cargo test -p gotchaandcargo test -p gotcha --all-features(including doctests).cargo check -p message.cargo clippy --all-features --workspace -- -D warnings.RUSTDOCFLAGS='-D warnings' cargo doc -p gotcha --all-features --no-deps.cargo fmt --all --checkandgit diff --check.All 11 GitHub CI checks passed for
d7bf36f7e84a5086d8b869451507c1b1b5a9cf27.Closes #96.