-
Notifications
You must be signed in to change notification settings - Fork 49
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
Listen for AbortSignal in writeAlgorithm #160
Conversation
When controller.signal is aborted, abort the current write operation so that the stream can close more quickly. Partially resolves WICG#152.
This specifies the behavior implemented in https://chromium-review.googlesource.com/c/chromium/src/+/3366788 and so resolves an issue which has been confusing me for awhile about one of the tests I wrote for aborting a stream while there was a write pending. This doesn't add any steps to closeAlgorithm but as implemented this would also unblock a close() as well. |
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.
Although the overall logic looks good, writeAlgorithm does not currently accept a controller, and it's bad form to access controller's public signal
property. Let me add some better hooks to the streams spec for you to use.
While you're adding better hooks I noticed that "set up" doesn't take a startAlgorithm and that would be a better place to add abort steps than every time writeAlgorithm is invoked. |
Oh, the intention was that startAlgorithm wasn't needed since you could just do that yourself as a sibling step of "set up". I think that works, if I expose "stream's signal"? |
That's an excellent point. |
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.
Beautiful!
SHA: 881d4b9 Reason: push, by @reillyeon Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
When controller.signal is aborted, abort the current write operation so that the stream can close more quickly.
Partially resolves #152.