Skip to content

diagnostics_channel: add diagnostics channels for web locks#62123

Open
IlyasShabi wants to merge 1 commit intonodejs:mainfrom
IlyasShabi:ishabi/web-lock-dc
Open

diagnostics_channel: add diagnostics channels for web locks#62123
IlyasShabi wants to merge 1 commit intonodejs:mainfrom
IlyasShabi:ishabi/web-lock-dc

Conversation

@IlyasShabi
Copy link
Member

This PR adds diagnostics channels support for locks.request() giving visibility into the lock request lifecycle.

Four channels are emitted:

  • locks.request.start when a request begins
  • locks.request.grant when the lock is granted
  • locks.request.miss when the lock is not immediately available
  • locks.request.end when the request finishes

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Mar 5, 2026
@IlyasShabi IlyasShabi marked this pull request as draft March 5, 2026 22:17
@IlyasShabi IlyasShabi force-pushed the ishabi/web-lock-dc branch from c92cc75 to 8ce0c9b Compare March 5, 2026 22:26
@IlyasShabi IlyasShabi marked this pull request as ready for review March 5, 2026 22:28
@IlyasShabi IlyasShabi changed the title locks: add diagnostics channels for web locks diagnostics_channel: add diagnostics channels for web locks Mar 5, 2026
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 89.47368% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.63%. Comparing base (da5efc4) to head (8ce0c9b).
⚠️ Report is 92 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/locks.js 89.47% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62123      +/-   ##
==========================================
+ Coverage   88.84%   89.63%   +0.79%     
==========================================
  Files         674      676       +2     
  Lines      204957   206396    +1439     
  Branches    39309    39532     +223     
==========================================
+ Hits       182087   184997    +2910     
+ Misses      15088    13524    -1564     
- Partials     7782     7875      +93     
Files with missing lines Coverage Δ
lib/internal/locks.js 94.39% <89.47%> (-0.70%) ⬇️

... and 225 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.

@IlyasShabi IlyasShabi requested review from BridgeAR and Qard March 6, 2026 13:01
@legendecas legendecas added the diagnostics_channel Issues and PRs related to diagnostics channel label Mar 6, 2026
* `mode` {string} The lock mode: `'exclusive'` or `'shared'`.

Emitted when `ifAvailable` is `true` and the lock is not immediately available.
The callback is invoked with `null` instead of a `Lock` object.
Copy link
Member

Choose a reason for hiding this comment

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

This channel callback has no parameter of Lock. What is this callback referring to?

Copy link
Member Author

Choose a reason for hiding this comment

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

Im referring to the user land callback passed to locks.request() not to the subscriber itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics_channel Issues and PRs related to diagnostics channel needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants