-
Notifications
You must be signed in to change notification settings - Fork 607
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 hold1
#3112
Fix hold1
#3112
Conversation
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.
Still a shame that uncons
and concurrently
don't seem to be composable.
I wouldn't necessarily conclude that. There's some bug hiding here that broke |
Yes, it needed the I don't really understand how all this scoping works, but it seemed like what was happening was some scope was being opened in the |
Wait, maybe there is a way :) let me try something fs2/core/shared/src/main/scala/fs2/Pull.scala Lines 460 to 467 in 597102b
|
No, that didn't work either. be8d3e7 |
Yeah, so |
I experimented with the idea that the scope of the background stream in I tried two different approaches, either interfacing directly with
Once I've mustered up new courage I'll probably take another shot at it. |
}.streamNoScope | ||
|
||
Stream.eval(Deferred[F2, Signal[F2, O2]]).flatMap { signal => | ||
Stream.eval(signal.get).concurrently(go(signal)) |
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.
This will result in Stream.never
if the signal never gets completed, e.g. if this
is empty.
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.
I think that's the behavior we want, no?
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.
I'm not sure. An empty stream is also an option. That's what the original implementation did afaict.
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.
Ah I see, we are not concerned with the case Stream.never.hold1
(which never emits but never ends) but with the case Stream.empty.hold1
. So there should be an onFinalize
or something.
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, the fix was even easier than I realized, no need for onFinalize
:)
Fixes #3081.