Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Saturn225
Copy link
Contributor

@Saturn225 Saturn225 commented Jun 2, 2025

/claim #9701

This patch fixes a race in ZStream.async on Scala Native where the end marker could overtake pending chunk offers which causing some elements to be dropped. Rather than spawning a fiber for each chunk, we now enqueue each chunk synchronously (.run(...)) before returning so that all 10 items are guaranteed to be in the queue before cb.end

A new test is added that runs the same 10‐element stream 100 times to confirm no elements are ever lost

@Saturn225 Saturn225 marked this pull request as ready for review June 2, 2025 23:29
Copy link
Contributor

@kyri-petrou kyri-petrou left a comment

Choose a reason for hiding this comment

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

LGTM, although given that we don't have to worry about binary incompatibility with Scala Native, I recommend changing the method signatures to replace Future[Boolean] with Unit so that we can keep the code consistent with the JVM variant

@Saturn225 Saturn225 requested a review from kyri-petrou June 4, 2025 06:20
@Saturn225
Copy link
Contributor Author

@kyri-petrou I have addressed the review comments. Could you please have another look when you get a chance?

@Saturn225 Saturn225 requested a review from kyri-petrou June 4, 2025 15:03
@Saturn225
Copy link
Contributor Author

@kyri-petrou Can this be merged now?

@kyri-petrou kyri-petrou linked an issue Jun 10, 2025 that may be closed by this pull request
@Saturn225
Copy link
Contributor Author

@kyri-petrou Done!

Copy link
Contributor

@kyri-petrou kyri-petrou left a comment

Choose a reason for hiding this comment

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

Thanks!

@kyri-petrou kyri-petrou merged commit bc7c30e into zio:series/2.x Jun 11, 2025
19 checks passed
@Saturn225 Saturn225 deleted the fix/native-Zstream-async branch June 11, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZStream.async issue on scala-native

3 participants