-
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: ensure finish is emitted in next tick #30733
Conversation
@Trott: Who's familiar with |
e197831
to
a9e54cc
Compare
a9e54cc
to
7ee659f
Compare
When using end() it was possible for 'finish' to be emitted synchronously.
7ee659f
to
cdc12a6
Compare
@benjamingr can I get a nodejs/streams ping on this one? |
|
@nodejs/streams also this is terrifying :D |
This needs another @nodejs/tsc approval (@mcollina?) but should otherwise be good to go |
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
@Trott: |
CITGM looks good. |
When using end() it was possible for 'finish' to be emitted synchronously. PR-URL: #30733 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Landed in e13a37e |
When using
end()
it was possible for'finish'
to be emitted synchronously causing incorrect behaviour and subtle bugs.This is an edge case not usually encountered since a
write()
is usually pending and will be the one to initiatefinishMaybe()
throughafterWrite
which is always async.This PR also cause
_destroy()
to be called in nextTick whenautoDestroy
is enabled during this edge case.NOTE:
'prefinish'
must be synchronous in order to not breakTransform
. I've got another PR in the works to sort this out.Should probably be semver major.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes