-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
Backport promise cancellation support to v1 Promise API #48
Conversation
👍 |
This now also contains the fix from #47 so that the cancellation handler will not be called more than once. Ready for review |
|
||
$canceller = $this->canceller; | ||
$this->canceller = null; | ||
|
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.
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.
Alternatively, you could throw in the constructor, similar to here.
Thanks for the hint @jsor, makes perfect sense 👍 I've just pushed an update, I've decided to throw an |
Backport promise cancellation support to v1 Promise API
This is an independent backport of promise cancellation support for the legacy v1 Promise API. It implements the same API as originally implemented in #20, but does not share a single line of code. Original concept courtesy of @jsor.
The main purpose here is backwards compatibility for promise consumers, which can rely on the cancellation API to be available for newer v2 as well as legacy v1 promises.