-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
stream: async iterator destroy compat #29176
Conversation
@mcollina is there a reason why it's not done like this instead? |
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.
I’m ok in changing the async iterator. I’m -1 in changing destroy().
The callback in destroy predates adding finished to node core.
|
The biggest issue I have with this is that it's undocumented and monkey patched
There are a few
An alternative is to make it documented and part of the public API? Also, I wouldn't mind fixing the once that are streams. |
a062e90
to
4e76538
Compare
The callback property was added because it was needed somewhere in core. Maybe that has changed somehow, but I would rather wait before calling it deprecated. Fixing the stream iterator thing is important anyway, good spot. |
81f38d2
to
f168368
Compare
Can you add a test with an overridden destroy with no callback? |
You might want to change the name of the PR and the commit message. |
Added test |
f168368
to
9b36299
Compare
Messages fixed |
9b36299
to
81118d4
Compare
Yep. I can see it now. Classes that inherit from streams use it sometimes. But it doesn't ever seem to be used outside of the implementation (except for the case with this PR). We might want to consider refactoring that and calling the method something else hidden behind a symbol. |
Created a follow up issue #29180 |
e08ccc1
to
71c4984
Compare
const stream = this[kStream]; | ||
|
||
// TODO(ronag): Remove this check once finished() handles | ||
// already destroyed streams. |
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.
Isn’t that part of another PR?
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, put this as blocked and wait for that first?
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.
71c4984
to
e1290f2
Compare
async iterator should not depend on internal API for better compat with streamlike objects.
e1290f2
to
98fcb56
Compare
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
async iterator should not depend on internal API for better compat with streamlike objects. PR-URL: #29176 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 4e188b3 |
async iterator should not depend on internal API for better compat with streamlike objects. PR-URL: #29176 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
destroy with callback can achieved using destroy
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes