-
-
Notifications
You must be signed in to change notification settings - Fork 149
Follower cancellation propagation #99
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
Follower cancellation propagation #99
Conversation
Are you backporting this to |
@WyriHaximus I haven't planned that. I think you're asking for reactphp/http#213. If a version of react/promise is supported which doesn't have this patch, then cancellation propagation must be manually implemented, like here: https://github.com/reactphp/http/pull/213/files#diff-45da203c5746d523d3d75762c539b707R56 I took care to be backward compatible, so that a canceller registered with a follower takes precedence over the canceller from the parent promise: https://github.com/reactphp/promise/pull/99/files#diff-71f7b9a6df57aaf364b33eacad82e245R116 |
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.
LGTM
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.
Good catch, change LGTM! 👍
Shouldn't this be filed against current master
and then be backported for the v2
branch? Either way, I'm good with this
@clue I'm not sure tbh what's common practice here. I've done that always by starting a patch for the latest released version and then porting down to older and/or up to unreleased versions. |
Revert follower cancellation propagation (#99)
For reference only: This PR has been reverted via #122 for this release and is planned for a future release instead. |
This PR implements cancellation propagation for promises following another promise in the same way currently implemented for child promises created by
then()
.Consider the following code:
The behaviour is identical regarding resolution. Both
$child
and$follower
follow$root
which means, both will be fulfilled or rejected in the same way as$root
.The behaviour is different regarding cancellation though.
$child->cancel()
is called,$root
is cancelled although$follower
is still interested in the result.$follower->cancel()
is called, cancellation is not propagated to$root
.This PR fixes that, so
$follower
propagates cancellation in the same way as$child
.