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#debounce interruption issue #3765
Conversation
Actually, I think only the |
Done |
I will change |
Done |
@iravid this is ready for review |
}.onInterrupt( | ||
ref.get.flatMap { | ||
case Previous(fiber) => fiber.interrupt | ||
case Current(fiber) => fiber.interrupt | ||
case _ => ZIO.unit | ||
} | ||
) |
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.
Sorry for this PR dragging out. It's probably better for this finalizer to be attached to the construction of the Ref
; this way the fiber is interrupted even if the stream is interrupted "in-between" pulls. What do you think?
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.
@iravid I think you mean:
Ref.make[State](NotStarted).toManaged {
_.get.flatMap {
case Previous(fiber) => fiber.interrupt
case Current(fiber) => fiber.interrupt
case _ => ZIO.unit
}
}
Don't you?
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.
Yes, exactly
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.
@iravid makes sense, done. Also added a new test case for the fiber interruption.
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.
Thank you @luis3m!
Relates to #3740