-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Rely on stream.destroy() whenever available #4095
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
Anyone want to have a look at this? |
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.
This looks good. It's great to have these additional tests and to stay up to date with node. I don't detect any breaking changes since destroy()
effectively constitutes a close()
(e.g. including events that are subsequently emitted), and as far as I can tell should always take care of unpiping.
Yeah, the stream integration is quite defensive, as streams were not that aligned during the earlier implementation. The story is much better now, and we can mostly just trust that client streams are somewhat well-behaved. I'll see about re-basing this PR, and create a followup with a breaking change to deprecate any streams that don't include a |
Incidentally, shot is one such broken client, as per #4149 & hapijs/shot#129 😬 |
As usual thanks for looking into this @kanongil. I am sure you probably noticed already but there is a conflict. |
bbcc42b
to
8ac58d8
Compare
Rebased, and aliased the |
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 don't have an extensive knowledge about Streams but this LGTM. I also like the fact that we are following Node improvements.
There are also still some merge conflicts.
Also updates a bunch of stream closing related test.
ReadableStream
has included a.destroy()
method since node 8. People can still provide older streams through oldreadable-stream
module implementations.Btw. non-destroyable streams should probably just error when returned from a handler, but that is a breaking change.