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.13%. Comparing base (453f47a) to head (2695065).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65507      +/-   ##
==========================================
- Coverage   90.14%   90.13%   -0.02%     
==========================================
  Files         751      751              
  Lines      252709   252722      +13     
  Branches    47557    47567      +10     
==========================================
- Hits       227800   227783      -17     
- Misses      16206    16212       +6     
- Partials     8703     8727      +24     
Files with missing lines Coverage Δ
lib/internal/webworker.js 92.79% <100.00%> (+0.09%) ⬆️

... and 28 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Web Workers

4 participants