-
-
Notifications
You must be signed in to change notification settings - Fork 36
docs: usage with node-redis in cluster mode #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Please double-check this @gamemaker1 & @Gandalf1783 Fixes #207 (hopefully)
|
As stated in #207 I will hopefully test this in the next few days. |
Member
Author
|
No rush; take care of yourself first and test this when you're ready :) |
|
The correct code is actually |
nfriedly
added a commit
to nfriedly/node-redis
that referenced
this pull request
Aug 12, 2025
We noticed that `sendCommand()` takes different arguments for clusters vs clients, and I wanted to document the differences. I think I got it correct, but please review closely just to be sure. It might also be worth adding a note to [the readme](https://github.com/redis/node-redis/blob/2f106324507eec905b8fe7691ba11179acdeeca7/README.md#L136-L144) also, since this is a somewhat unexpected difference, what do you think? Relates to express-rate-limit/rate-limit-redis#207 & express-rate-limit/rate-limit-redis#208
3 tasks
use args[1] for firstKey instead of undefined so that commands are routed to the correct node instead of a random one.
nfriedly
added a commit
that referenced
this pull request
Aug 13, 2025
Should have been part of #208
nfriedly
added a commit
that referenced
this pull request
Nov 18, 2025
This adds a `sendCommandCluster` option as an alternative to `sendCommand`. It can be set to a function that is passed an object with the key and isReadOnly value, in addition to the command. This provides everything that node-redis needs in cluster mode, and is expandable with new fields if necessary to support other libraries in cluster mode. Additionally I tweaked the internals to always pass this information along - previously the key would be lost when loading the script, so it could inadvertenly get sent to the wrong redis server. Fixes #222 Fixes #207 Fixes #208
nfriedly
added a commit
that referenced
this pull request
Nov 19, 2025
This adds a `sendCommandCluster` option as an alternative to `sendCommand`. It can be set to a function that is passed an object with the key and isReadOnly value, in addition to the command. This provides everything that node-redis needs in cluster mode, and is expandable with new fields if necessary to support other libraries in cluster mode. Additionally I tweaked the internals to always pass this information along - previously the key would be lost when loading the script, so it could inadvertenly get sent to the wrong redis server. Fixes #222 Fixes #207 Fixes #208
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.
I added @gamemaker1's example to the readme.
We'll wait for @Gandalf1783 to confirm it works before merging this in.
Fixes #207 (hopefully)