-
-
Notifications
You must be signed in to change notification settings - Fork 243
Cancel should always wait for the finalizer #1120
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
Conversation
oleg-py
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.
Ok, I have very little understanding of what it actually does, but the tests look reasonable :)
My understanding of finalizers implementation goes like this:
The problem was that after setting I added Sorry for a chaotic explanation but I hope it adds a bit more context :D |
|
Would like to do a review — please allow me until Monday, or if I go silent again, then proceed without me 😀 |
|
Awesome @alexandru I will really appreciate it! During my work on I'm about to update PR because I also recognized an issue with our parallel operators. conn.cancel.runAsyncAndForget
cb.onError(ex)which causes some problems, e.g. import monix.execution.Scheduler.Implicits.global
Task.race(
Task.sleep(1.seconds).bracket(_ => Task.unit)(_ => Task { println("release") }),
Task.sleep(100.millis)
).flatMap(_ => Task(println("end"))).runSyncUnsafe()will exit the program without waiting for |
|
@alexandru I am merging it but if you find time to go through it then we could just do a follow up PR :D |
* Cancel should always wait for the finalizer * Remove leftover comments * Fix tryReactivate * add extra test * Backpressure on finalizers in parallel operators * Suspend p.success() outside CAS loop * Update TaskConnection.scala
Port of my change in typelevel/cats-effect#727 but we also support
tryReactivateto implementonCancelRaiseError. Prior to the PR we backpressured finalizers only for the first actionI'm not sure how to handle
def tryReactivate(): Boolean, I did something that might work but any suggestions welcome. It doesn't wait for finalizers BUT the method is private and only exists foronCancelRaiseErrorinconn.cancel.map(_ => ...)so it shouldn't be an issue.Fixes #1086 and fixes #1124