Repository navigation
worker: add diagnostic channel 'worker_threads.main.registry' - #67311
ShogunPanda wants to merge 4 commits into
Conversation
Signed-off-by: Paolo Insogna <paolo@cowtech.it> Assisted-By: OpenAI:GPT-6.1 Sol <openai/gpt-6.1-sol>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67311 +/- ##
==========================================
- Coverage 93.00% 90.74% -2.27%
==========================================
Files 428 798 +370
Lines 195818 280004 +84186
Branches 30283 53852 +23569
==========================================
+ Hits 182117 254077 +71960
- Misses 13375 16236 +2861
- Partials 326 9691 +9365
🚀 New features to boost your workflow:
|
| port.unref(); | ||
|
|
||
| if (registryChannel.hasSubscribers) { | ||
| registryChannel.publish({ threadIds: ArrayFrom(threadsPorts.keys()) }); |
There was a problem hiding this comment.
Nit: I haven't checked the convention for other things, but I suspect we should be using null proto objects for these. (not blocking)
|
|
||
| Emitted when a new thread is created. | ||
|
|
||
| ##### Event: `'worker_threads.main.registry'` |
There was a problem hiding this comment.
The name's connection with "messaging port" here is a bit unclear and confusing. Specifically, unless you know how the implementation works, "main registry" and "messaging port" are not obviously connected.
Signed-off-by: Paolo Insogna <paolo@cowtech.it> Assisted-by: GPT-6.1 Sol
|
Thanks for the review, @jasnell! Both registry event payloads now use null-prototype objects, and the test checks this explicitly. I also updated the documentation to describe the worker thread registry first, then explain how internal messaging ports track its entries and why snapshots do not guarantee that workers are ready or still running. I kept the channel name unchanged. Could you take another look? |
Summary
Add
worker_threads.main.registryto expose changes to the worker messaging registry through diagnostics_channel.Changes
{ threadIds }snapshots on registration and removal, including nested workers.Notes
Registration does not guarantee readiness. Removal depends on the parent processing the worker's exit and can be delayed if the parent is blocked.
Additional Informations
AI-assisted work. All changes reviewed by a human.