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

join should yield item immediately if either stream is ready #13

Merged
merged 4 commits into from
Dec 29, 2022

Conversation

zeenix
Copy link
Collaborator

@zeenix zeenix commented Dec 27, 2022

If one of the streams is ready and the other is pending, we should just return the item from the ready stream. Otherwise, join will never resolve until both streams are ready (which could be never).

Fixes #12.

@zeenix zeenix requested a review from danieldg December 27, 2022 23:12
If one of the streams is ready and the other is pending, we should
just return the item from the ready stream. Otherwise, join will never
resolve until both streams are ready (which could be never).

Fixes danieldg#12.
@zeenix
Copy link
Collaborator Author

zeenix commented Dec 29, 2022

After a lot of testing against zbus, I'm confident about these fixes to address the issue at hand. It remains another discussion if the "issue" is very much intentional. The way we've so far been using it in zbus, #12 didn't pose any issues cause we were joining method calls with message streams, where both of them were pretty much guaranteed to yield values quickly.

This is now about to change in zbus with my in progress work to enable match-rule-based message streams where a task is only awaken for messages that it is interested in. These specific streams therefore are not always able to produce values so if i join such a stream with a method call, the method call is guaranteed to hang without this PR.

Anyway, I'm merging this now. I understand you're probably taking time off during this season so I'll try my best to hold off releasing as long as possible, in case you've better ideas on how to handle this.

@zeenix zeenix merged commit ea007ff into danieldg:master Dec 29, 2022
@zeenix zeenix deleted the fix-join branch December 29, 2022 16:57
@danieldg
Copy link
Owner

danieldg commented Feb 5, 2023

Sorry about the delay looking at this; I took a quick look and thought it was fine, but didn't take time to really think about the edge cases until recently.

@zeenix
Copy link
Collaborator Author

zeenix commented Feb 5, 2023

Sorry about the delay looking at this; I took a quick look and thought it was fine, but didn't take time to really think about the edge cases until recently.

Now that you're available, could you please address my concerns/problems I described above before undoing my work? Thanks.

@danieldg
Copy link
Owner

danieldg commented Feb 5, 2023

The reason I did not release is because I did want your feedback. In the future, I will do it via MR; I didn't think about that.

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.

Join remains Pending until both streams yield an item
2 participants