Skip to content
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

Set FIRST_KEY_INDEX if a script accepts keys #2858

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

poiuj
Copy link

@poiuj poiuj commented Oct 21, 2024

Description

Setting FIRST_KEY_INDEX ensures we send the script to the right node, instead of sending to random node and repeating on getting MOVED response. Relying on a random node send increases traffic and exceeds maxCommandRedirections configuration with non-zero probability.

Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

Setting FIRST_KEY_INDEX ensures we send the script to the right node,
instead of sending to random node and repeating on getting MOVED
repsonse. Relying on a random node send increases traffic
and exceeds maxCommandRedirections configuration with non-zero
probability.
@poiuj
Copy link
Author

poiuj commented Oct 21, 2024

This one replaces #2848, closed by mistake.

@poiuj
Copy link
Author

poiuj commented Oct 21, 2024

@leibale could you take a look?

@poiuj
Copy link
Author

poiuj commented Nov 13, 2024

@leibale do you have specific concerns about this change?

@leibale
Copy link
Collaborator

leibale commented Nov 13, 2024

  1. sorry about the long delay
  2. IIRC, NUMBER_OF_KEYS is used by the cluster client to extract the key, I don't think FIRST_KEY_INEDX is needed
  3. this API does not exist anymore, we are using https://github.com/redis/node-redis/blob/master/packages/client/lib/client/parser.ts instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants