-
Notifications
You must be signed in to change notification settings - Fork 614
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
Nonemiting Pure Stream cannot be interrupted (stay to run in background) #1010
Comments
Btw, I suspect that any drained streams are subject of this issue, and perhaps you recall my poor experince with drained streams recently, I believe this is the root cause of it. |
You could check an interrupt flag of some form in the case where the |
Yeah was my thought initially, however there is no penalty-free solution to insert interrupt flag to uncons, the only place I can think of is from scope, and that have drastic performance impact. |
@mpilquist also please note in this particular case the split seems to never terminate, just again and again runs the constant segment w/o emitting single value. |
Yeah, |
@mpilquist I have investigated it further (as the last work on Segment didn't help here) and seems this is what is going on:
Essentially no chance to exit this loop |
ok @mpilquist this seems to do trick. Not sure, tho if this is most generic way, as this could hit any combinator now ? private def dropWhile_(p: O => Boolean, dropFailure: Boolean): Pull[F,Nothing,Option[Stream[F,O]]] =
uncons.map {
case None => None
case Some((hd, tl)) =>
hd.force.dropWhile(p, dropFailure) match {
case Left(_) => println("DROP_ L"); Some(tl.pull.dropWhile_(p, dropFailure).streamNoScope)
case Right(tl2) => println("DROP_ R"); Some(tl.cons(tl2))
}
}
|
nvm, obviously that doesn't seem to help. Any ideas how to solve this ? |
@pchlupacek We could add a |
Ok, that would sort of require to bring |
Or lets say I don't know how to build Pull.checkInterrupt w/o consulting |
Without knowing more of the technique you are using for interruption, I can't say. I was thinking that adding a new primitive would yield control to the |
I'll push that to branch(topic/interrupt). @mpilquist it is very rough, but look on Algebra.interrupt. The problem is that any way to |
resolved by #1019 |
The stream terminates, however s1 still runs in background unitl JVM finishes.
The reason is that s1 is pure Segment than never emits value.
@mpilquist any idea how to shortcut from segment in this case? I just need to exit the segment not only when the values are ready but also each
n
steps, and seems themaxSteps
in uncons are not enough.The text was updated successfully, but these errors were encountered: