Skip to content
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

Promise version of streams.finished not calling clean up #44556

Closed
rhodgkins opened this issue Sep 7, 2022 · 11 comments
Closed

Promise version of streams.finished not calling clean up #44556

rhodgkins opened this issue Sep 7, 2022 · 11 comments
Labels
good first issue Issues that are suitable for first-time contributors. stream Issues and PRs related to the stream subsystem.

Comments

@rhodgkins
Copy link

rhodgkins commented Sep 7, 2022

function finished(stream, opts) {
return new Promise((resolve, reject) => {
eos(stream, opts, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}

Should the promise version of finished call the clean up function returned from the callback version?

So something like:

function finished(stream, opts) {
  return new Promise((resolve, reject) => {
    const cleanup = eos(stream, opts, (err) => {
      cleanup();
      if (err) {
        reject(err);
      } else {
        resolve();
      }
    });
  });
}
@rhodgkins rhodgkins changed the title Promise version of finished not calling clean up Promise version of streams.finished not calling clean up Sep 7, 2022
@rhodgkins rhodgkins changed the title Promise version of streams.finished not calling clean up Promise version of streams.finished not calling clean up Sep 7, 2022
@VoltrexKeyva VoltrexKeyva added the stream Issues and PRs related to the stream subsystem. label Sep 7, 2022
@mcollina
Copy link
Member

mcollina commented Sep 7, 2022

cc @nodejs/streams

@mcollina
Copy link
Member

mcollina commented Sep 7, 2022

@ronag wdyt?

@mcollina
Copy link
Member

mcollina commented Sep 7, 2022

Would you like to send a PR?

@rhodgkins
Copy link
Author

Yeh can do, I've never contributed to this repo before - would tests or anything be needed or will just the above change be ok?

@mcollina
Copy link
Member

mcollina commented Sep 7, 2022

Test will be needed.

@ronag
Copy link
Member

ronag commented Sep 28, 2022

Note that changing this semver-major. I would prefer if we added an option to the promisified version, .e.g autoCleanup: true or something like that which we can later change the default of if/when we want as semver-major change.

@ronag ronag added the good first issue Issues that are suitable for first-time contributors. label Sep 28, 2022
@tony-go
Copy link
Member

tony-go commented Oct 2, 2022

Hey 👋

If our friend @rhodgkins finally doesn't jump on this. I would like to jump :)

Cheers

@mcollina
Copy link
Member

mcollina commented Oct 2, 2022

Go for it!

@rhodgkins
Copy link
Author

Yep sorry I'm not going to be able to do this any time soon so thanks in advance if you get time to do it! 🎉

ntedgi added a commit to ntedgi/node that referenced this issue Oct 2, 2022
ref: nodejs#44556
src: add autoCleanup logic to finished
docs: add autoCleanup true as default
@tony-go
Copy link
Member

tony-go commented Oct 2, 2022

It seems that @ntedgi already jump into. I'll take another one 🤓

ntedgi added a commit to ntedgi/node that referenced this issue Oct 2, 2022
ref: nodejs#44556
src: add autoCleanup logic to finished
docs: add autoCleanup true as default
ntedgi added a commit to ntedgi/node that referenced this issue Oct 2, 2022
add autoCleanup logic to finished, update docs add autoCleanup false as default

ref: nodejs#44556
ntedgi added a commit to ntedgi/node that referenced this issue Oct 2, 2022
implement autoCleanup logic. update docs add autoCleanup description

ref: nodejs#44556
nodejs-github-bot pushed a commit that referenced this issue Oct 15, 2022
implement autoCleanup logic. update docs add autoCleanup description

ref: #44556
PR-URL: #44862
Refs: #44556
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
@targos
Copy link
Member

targos commented Oct 22, 2022

Fixed by #44862

@targos targos closed this as completed Oct 22, 2022
RafaelGSS pushed a commit that referenced this issue Nov 1, 2022
implement autoCleanup logic. update docs add autoCleanup description

ref: #44556
PR-URL: #44862
Refs: #44556
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
RafaelGSS pushed a commit that referenced this issue Nov 10, 2022
implement autoCleanup logic. update docs add autoCleanup description

ref: #44556
PR-URL: #44862
Refs: #44556
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams pushed a commit that referenced this issue Dec 30, 2022
implement autoCleanup logic. update docs add autoCleanup description

ref: #44556
PR-URL: #44862
Refs: #44556
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams pushed a commit that referenced this issue Dec 30, 2022
implement autoCleanup logic. update docs add autoCleanup description

ref: #44556
PR-URL: #44862
Refs: #44556
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams pushed a commit that referenced this issue Jan 3, 2023
implement autoCleanup logic. update docs add autoCleanup description

ref: #44556
PR-URL: #44862
Refs: #44556
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are suitable for first-time contributors. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

6 participants