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
Merging streams causes 2 chunks to be emmited instead of 1 #1987
Comments
This is caused by the implementation of It pulls the next chunk from the source stream and then acquires the semaphore permit, which is blocked until previous chunk is processed from the queue. Hence, it's always reading 1 chunk ahead. To fix, we can move the guard acquisition to happen before the pull from source stream. One way to do this is |
I'm running into the issue about
merge
ing 2fs2.Stream
s and processing the resulting Stream further. Consider the following example:Expected output:
Actual output:
As far as I can tell from digging into the implementation of
merge
the issue is with theSemaphore(1)
. Instead of emitting 1 chunk it puts 2 chunks immediately which is not really expected.Increasing the number of permits to
n
causesn+1
chunks to be emitted at once.The text was updated successfully, but these errors were encountered: