-
Notifications
You must be signed in to change notification settings - Fork 30k
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
lib: promise version of streams.finished
call cleanup after eos
#44862
Conversation
Review requested:
|
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.
Thanks for opening a PR! Can you please add a unit test?
i added the following tests
In addition, I want to make sure that the cleanup function has been called as expected I didn't find any example of how to detect listeners has been properly removed I see it hasn't been tested here as well : https://github.com/nodejs/node/blob/main/test/parallel/test-stream-end-of-streams.js Can you please help me think of a simple way to check |
Thank you anyway, I was able to find a simple solution
|
streams.finished
call clean upstreams.finished
call clean up
1ba59b1
to
669dc00
Compare
implement autoCleanup logic. update docs add autoCleanup description ref: nodejs#44556
doc: update autoCleanup default value to false
streams.finished
call clean upstreams.finished
call cleanup after eos
{ | ||
const streamObj = new Writable(); | ||
assert.strictEqual(streamObj.listenerCount('end'), 0); | ||
finished(streamObj, { cleanup: true }).then(() => { |
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.
Nitpic: wrap with common.mustCall
{ | ||
const streamObj = new Writable(); | ||
assert.strictEqual(streamObj.listenerCount('end'), 0); | ||
finished(streamObj).then(() => { |
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.
Same
Landed in 84064bf |
implement autoCleanup logic. update docs add autoCleanup description ref: #44556 PR-URL: #44862 Refs: #44556 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
implement autoCleanup logic. update docs add autoCleanup description ref: #44556 PR-URL: #44862 Refs: #44556 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
implement autoCleanup logic. update docs add autoCleanup description ref: #44556 PR-URL: #44862 Refs: #44556 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
implement autoCleanup logic. update docs add autoCleanup description ref: #44556 PR-URL: #44862 Refs: #44556 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
implement autoCleanup logic. update docs add autoCleanup description ref: #44556 PR-URL: #44862 Refs: #44556 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
PR-URL: #55043 Refs: #44862 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #55043 Refs: #44862 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: nodejs#55043 Refs: nodejs#44862 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: nodejs#55043 Refs: nodejs#44862 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
ref: #44556
src: add autoCleanup logic to finished
docs: add autoCleanup true as default