-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix ZStream.async dropping elements on Scala Native
#9925
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
Fix ZStream.async dropping elements on Scala Native
#9925
Conversation
kyri-petrou
left a comment
There was a problem hiding this 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
|
@kyri-petrou I have addressed the review comments. Could you please have another look when you get a chance? |
managed/native/src/main/scala/zio/managed/ZManagedCompatPlatformSpecific.scala
Outdated
Show resolved
Hide resolved
|
@kyri-petrou Can this be merged now? |
streams-tests/jvm-native/src/test/scala/zio/stream/ZStreamPlatformSpecific2Spec.scala
Outdated
Show resolved
Hide resolved
|
@kyri-petrou Done! |
kyri-petrou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/claim #9701
This patch fixes a race in
ZStream.asyncon 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 beforecb.endA new test is added that runs the same 10‐element stream 100 times to confirm no elements are ever lost