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

lib: refactor project to use Promise.withResolvers #54836

Merged
merged 2 commits into from
Oct 19, 2024

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Sep 7, 2024

Node.js v22+ supports Promise.withResolvers(). Let's use them!

@anonrig anonrig added dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. labels Sep 7, 2024
@anonrig anonrig requested a review from aduh95 September 7, 2024 17:17
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/streams
  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Sep 7, 2024
Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After all these years - this is still a bad API but we might as well use the official one :D

@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 7, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 7, 2024
@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 7, 2024
Copy link
Member

@atlowChemi atlowChemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anonrig could this have any impact on pref?
Should any benchmarks be run?

@RedYetiDev RedYetiDev added the promises Issues and PRs related to ECMAScript promises. label Sep 7, 2024
@anonrig
Copy link
Member Author

anonrig commented Sep 7, 2024

@anonrig could this have any impact on pref?

Should any benchmarks be run?

I think it will improve performance but I'm not sure. Once the tests pass, let's have a benchmark ci just to be sure.

@RedYetiDev RedYetiDev added the needs-benchmark-ci PR that need a benchmark CI run. label Sep 7, 2024
@jasnell
Copy link
Member

jasnell commented Sep 7, 2024

PromiseWithResolvers isn't in primordials yet, is it?

@anonrig
Copy link
Member Author

anonrig commented Sep 7, 2024

PromiseWithResolvers isn't in primordials yet, is it?

It seems like it can be removed by a v8 flag: https://github.com/v8/v8/blob/3b12a031d2293acf01872e213473c8657671c8db/src/init/bootstrapper.cc#L5585

@anonrig anonrig marked this pull request as draft September 7, 2024 22:27
@aduh95
Copy link
Contributor

aduh95 commented Sep 7, 2024

We should probably wait for 20.x to be in maintenance so it does not create conflicts when backporting other PRs (we could also wait for V8 to drop the flag, but we don't officially support running Node.js with undocumented flags, so that's not a blocker)

@jasnell
Copy link
Member

jasnell commented Sep 8, 2024

@anonrig ... I see you marked this author ready but the PR is still a draft. Going to remove the label for now until you confirm this is ready.

@jasnell jasnell removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 8, 2024
@jasnell
Copy link
Member

jasnell commented Sep 8, 2024

We should probably wait for 20.x to be in maintenance so it does not create conflicts when backporting other PRs (we could also wait for V8 to drop the flag, but we don't officially support running Node.js with undocumented flags, so that's not a blocker)

Alternatively, if we choose to backport this, we could also choose to polyfill Promise.withResolvers() in the older release lines.

@aduh95
Copy link
Contributor

aduh95 commented Sep 8, 2024

We should probably wait for 20.x to be in maintenance so it does not create conflicts when backporting other PRs (we could also wait for V8 to drop the flag, but we don't officially support running Node.js with undocumented flags, so that's not a blocker)

Alternatively, if we choose to backport this, we could also choose to polyfill Promise.withResolvers() in the older release lines.

We've decided that any change to globally available APIs would be semver-major in #54330 (I mean it hasn't landed yet, but it already has your approval 😅), so backporting to v20.x is a no-go.

@anonrig anonrig force-pushed the get-rid-of-deferred-promise branch 2 times, most recently from 0c08b61 to c69b907 Compare September 8, 2024 14:53
@anonrig anonrig marked this pull request as ready for review September 8, 2024 14:53
@aduh95 aduh95 added the blocked PRs that are blocked by other issues or PRs. label Sep 25, 2024
@aduh95
Copy link
Contributor

aduh95 commented Sep 25, 2024

Blocked on #55115

@aduh95 aduh95 removed the blocked PRs that are blocked by other issues or PRs. label Oct 4, 2024
@aduh95
Copy link
Contributor

aduh95 commented Oct 17, 2024

This needs a rebase.

anonrig and others added 2 commits October 18, 2024 10:58
# Conflicts:
#	lib/internal/blob.js
#	lib/internal/test_runner/harness.js
#	lib/internal/test_runner/runner.js
#	test/parallel/test-runner-run-watch.mjs
#	test/parallel/test-runner-watch-mode-complex.mjs
#	test/parallel/test-runner-watch-mode.mjs
Co-authored-by: Antoine du Hamel <[email protected]>
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Oct 18, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 18, 2024
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 merged commit bb8cc65 into nodejs:main Oct 19, 2024
63 checks passed
@aduh95
Copy link
Contributor

aduh95 commented Oct 19, 2024

Landed in bb8cc65

aduh95 pushed a commit that referenced this pull request Oct 19, 2024
PR-URL: #54836
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
@aduh95 aduh95 mentioned this pull request Oct 24, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#54836
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
tpoisseau pushed a commit to tpoisseau/node that referenced this pull request Nov 21, 2024
PR-URL: nodejs#54836
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
@ruyadorno
Copy link
Member

This commit does not land cleanly on v22.x-staging and will need manual backport in case we want it in v22.x.

@ruyadorno ruyadorno added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label Nov 27, 2024
aduh95 pushed a commit that referenced this pull request Nov 27, 2024
PR-URL: #54836
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
@aduh95 aduh95 added backported-to-v22.x PRs backported to the v22.x-staging branch. and removed backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. labels Nov 27, 2024
ruyadorno pushed a commit that referenced this pull request Nov 27, 2024
PR-URL: #54836
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backported-to-v22.x PRs backported to the v22.x-staging branch. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. lib / src Issues and PRs related to general changes in the lib or src directory. needs-benchmark-ci PR that need a benchmark CI run. needs-ci PRs that need a full CI run. promises Issues and PRs related to ECMAScript promises.
Projects
None yet
Development

Successfully merging this pull request may close these issues.