Rely on stream.destroy() whenever available#4095
Conversation
|
Anyone want to have a look at this? |
devinivy
left a comment
There was a problem hiding this comment.
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 |
Also updates a bunch of stream closing related test.
ReadableStreamhas included a.destroy()method since node 8. People can still provide older streams through oldreadable-streammodule implementations.Btw. non-destroyable streams should probably just error when returned from a handler, but that is a breaking change.