-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: make finished try to wait for 'close' #32158
Conversation
This is waiting for/blocked by #32051 |
18c3de4
to
c13abc8
Compare
747fbf7
to
059b055
Compare
059b055
to
8f14903
Compare
9725ba8
to
2fc0856
Compare
let writableFinished = stream.writableFinished || | ||
(wState && wState.finished); | ||
const onfinish = () => { | ||
writableFinished = true; | ||
if (willEmitClose && (!stream.readable || readable)) return; |
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.
!stream.readable || readable
is for the case where the stream is Duplex
, but we might not want to wait for 'end'
in which case autoDestroy
won't be called and 'close'
won't be emitted. An example of this is:
await pipeline(readable, duplex)
For the last argument duplex
, pipeline
will set readable: false
explicitly for eos
to indicate 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.
LGTM, I'm ok with this.
If the last stream in a pipeline is still usable/readable don't destroy it to allow further composition. Fixes: #32105 PR-URL: #32110 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
2fc0856
to
c6cb45b
Compare
This comment has been minimized.
This comment has been minimized.
@ronag I guess this is no longer blocked now, but needs a rebase? |
c6cb45b
to
d244303
Compare
@ronag I’m not sure if this is a new conflict, but the Github UI still says that there are some… also, when adding |
d244303
to
4c83a29
Compare
needs another @nodejs/tsc approval |
rebased to fix conflicts |
735f412
to
81bdea7
Compare
This comment has been minimized.
This comment has been minimized.
Pipeline uses eos which will invoke the callback on 'finish' and 'end' before all streams have been fully destroyed. Fixes: nodejs#32032
81bdea7
to
4f76b58
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
green CI & CITGM, waiting for another @nodejs/tsc approval |
Pipeline uses eos which will invoke the callback on 'finish' and 'end' before all streams have been fully destroyed. Fixes: #32032 PR-URL: #32158 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Landed in 1428a92 |
Pipeline uses eos which will invoke the callback
on 'finish' and 'end' before all streams have been
fully destroyed.
Fixes: #32032
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes