Skip to content

worker: add ref/unref to web workers - #65507

Open
avivkeller wants to merge 4 commits into
nodejs:mainfrom
avivkeller:worker-ref-unref
Open

worker: add ref/unref to web workers#65507
avivkeller wants to merge 4 commits into
nodejs:mainfrom
avivkeller:worker-ref-unref

Conversation

@avivkeller

Copy link
Copy Markdown
Member

Fixes #43583 (comment) by adding the non-standard ref and unref methods.

Signed-off-by: avivkeller <me@aviv.sh>
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Aug 23, 2026
@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (453f47a) to head (f5ec204).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #65507    +/-   ##
========================================
  Coverage   90.14%   90.14%            
========================================
  Files         751      751            
  Lines      252709   253661   +952     
  Branches    47557    47773   +216     
========================================
+ Hits       227800   228674   +874     
- Misses      16206    16245    +39     
- Partials     8703     8742    +39     
Files with missing lines Coverage Δ
lib/internal/webworker.js 92.79% <100.00%> (+0.09%) ⬆️

... and 56 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daeyeon daeyeon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather than the legacy per-object pattern, wouldn't process.ref()/.unref() (#53266) be a better fit here? It was designed for exactly this, avoiding non-standard method pollution on web platform APIs.

Comment thread lib/internal/webworker.js
@avivkeller

Copy link
Copy Markdown
Member Author

I totally forgot we had process.ref and process.unref! Fixed!

@avivkeller
avivkeller requested review from daeyeon and jasnell August 24, 2026 20:15
@panva panva added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. author ready PRs that have at least one approval, no outstanding review comments, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 24, 2026
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 outstanding review comments, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Web Workers

5 participants