fix(dispatcher): pass socketPath to custom connect callbacks#4857
Open
theamodhshetty wants to merge 2 commits intonodejs:mainfrom
Open
fix(dispatcher): pass socketPath to custom connect callbacks#4857theamodhshetty wants to merge 2 commits intonodejs:mainfrom
theamodhshetty wants to merge 2 commits intonodejs:mainfrom
Conversation
metcoder95
reviewed
Mar 3, 2026
Member
metcoder95
left a comment
There was a problem hiding this comment.
the implementation lgtm, but unsure about the usage of a symbol and embedding the path into the client instance
lib/dispatcher/client.js
Outdated
| this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout] | ||
| this[kServerName] = null | ||
| this[kLocalAddress] = localAddress != null ? localAddress : null | ||
| this[kSocketPath] = socketPath != null ? socketPath : null |
Member
There was a problem hiding this comment.
any reason of why this is needed?
Contributor
Author
|
Good callout, thanks. I pushed a follow-up to remove the symbol/client-instance storage approach. What I changed:
Commit: |
metcoder95
reviewed
Mar 3, 2026
| kBodyTimeout: Symbol('body timeout'), | ||
| kServerName: Symbol('server name'), | ||
| kLocalAddress: Symbol('local address'), | ||
| kSocketPath: Symbol('socket path'), |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4857 +/- ##
=======================================
Coverage 93.14% 93.15%
=======================================
Files 109 109
Lines 34239 34243 +4
=======================================
+ Hits 31893 31899 +6
+ Misses 2346 2344 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
Pool/RoundRobinPoolare created with a customconnectfunction,socketPathfrom dispatcher options is currently not forwarded to the connector callback options.This patch fixes that by:
socketPathin pool options passed down toClientsocketPathinClientconnector invocation options when presentbuildConnector.Optionstyping to include optionalsocketPathPoolandRoundRobinPoolFixes #3486.
Testing
node --test test/pool.js --test-name-pattern "passes socketPath to custom connect function"node --test test/round-robin-pool.js --test-name-pattern "passes socketPath to custom connect function"npx tsd --files test/types/connector.test-d.tsnpx eslint lib/core/symbols.js lib/dispatcher/client.js lib/dispatcher/pool.js lib/dispatcher/round-robin-pool.js test/pool.js test/round-robin-pool.js