8000 fix: drop join handle in spawn utils by grevgeny · Pull Request #337 · slawlor/ractor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: drop join handle in spawn utils #337

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grevgeny
Copy link
@grevgeny grevgeny commented Mar 5, 2025

This PR refactors ractor::spawn and ractor::spawn_named to drop the internal JoinHandle before returning the function’s output. Based on the current documentation and observed usage patterns, this change simplifies the API by removing unnecessary exposure of the JoinHandle to the caller.

Note: this is a breaking change.

Copy link
Owner
@slawlor slawlor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this was the original intention, it's actually more problematic to drop the join handle from these utilities and limits their usefulness. The JoinHandle serves a strong purpose in tracking the full exit of the future owning any spawned actor, and it should really be caller dependent if it's dropped.

It's a minor ergonomic overhead to drop it as the caller, either with await.0 or (actor, _) = ...::spawn(). Therefore I'm going to say no to these changes. Feel free to update the comments however, they are indeed out of date and incorrect.

@grevgeny
Copy link
Author
grevgeny commented Mar 5, 2025

I see, but isn't the idea about caller decision still holds?

I mean if they decide not to use the handle and stop and wait later, then they use this utility method. Otherwise, they use original method.

But then there is probably another problem with this method that it will include not just one, but two shortcuts: dropping handle and default for actor implementors.

@slawlor
Copy link
Owner
slawlor commented Mar 7, 2025

Yeah I'd prefer to keep this to one implied change. It's helpful for defaults but losing the join handle has a lot of consequences downstream

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

Successfully merging this pull request may close these issues.

2 participants
0