Uh oh!
There was an error while loading. Please reload this page.
stream: add auto-destroy mode - #22795
Conversation
mcollina
commented
Sep 10, 2018
@mafintosh I think it needs to call I think this is the first step to implement #20096, right? |
There was a problem hiding this comment.
.destroy() -> `.destroy()`?
There was a problem hiding this comment.
Can you provide the default value explicitly here?
It looks like the code in |
There was a problem hiding this comment.
Can you provide the default value explicitly here?
There was a problem hiding this comment.
Can we maybe check the order of the events/destroy callback as well?
addaleax
commented
Sep 14, 2018
Gentle ping @mafintosh :) @targos I think it’s this way around in order to support shutting down Duplex streams? |
mafintosh
commented
Sep 17, 2018
@addaleax i'll fix up the nits+comments |
Fishrock123
commented
Sep 17, 2018
Seems like a good addition to me, minus others' comments. |
tniessen
commented
Sep 19, 2018
semver-minor commits should contain metadata in the YAML |
There was a problem hiding this comment.
Just to make sure I’m not missing anything – how does this change relate to the others?
bb2cb3c to
387516cCompare387516c to
ccc94a9Comparemafintosh
commented
Oct 29, 2018
Fixed all the nits @addaleax@targos@vsemozhetbyt@Fishrock123 |
mafintosh
commented
Oct 29, 2018
mcollina
left a comment
There was a problem hiding this comment.
LGTM but I would like to see a CITGM run.
| pr-url: https://github.com/nodejs/node/pull/18438 | ||
| description: > | ||
| Add `emitClose` option to specify if `'close'` is emitted on destroy | ||
| - version: TBD |
There was a problem hiding this comment.
is the value we put here TBD? I never remember.
mafintosh
commented
Oct 29, 2018
mafintosh
commented
Oct 30, 2018
One more CITGM with readable-stream enabled master: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1606/ |
mafintosh
commented
Oct 30, 2018
The CITGM runs seem to report similar errors on master + this PR, landing ... |
PR-URL: nodejs#22795 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
mafintosh
commented
Oct 30, 2018
Landed in f24b070 |
PR-URL: #22795 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
PR-URL: #22795 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesThis adds a new options to the stream constructor called
autoDestroythat is default false.When autoDestroy is enabled .destroy() will automatically be called when the stream has ended and/or finished depending on whether it's a readable/writable/duplex.
This simplifies error handling / resource management for users as you can then always do your teardown logic in the destroy method.