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

Fix a memoization bug for cluster client #1283

Conversation

supercaracal
Copy link
Contributor

@supercaracal supercaracal commented Jun 3, 2024

Closes #1282

I fixed redis-cluster-client to be able to delay the initialization to the first query.

But I've forgotten to fix it on redis-clustering side. So this pull request fixes it.

@supercaracal supercaracal marked this pull request as ready for review June 3, 2024 22:27
@byroot byroot merged commit 6a8d165 into redis:master Jun 4, 2024
16 of 17 checks passed
@supercaracal supercaracal deleted the fix-cluster-client-delay-loading-for-router-module branch June 4, 2024 06:29
end

def server_url
@router.node_keys
@router.nil? ? @config.startup_nodes.keys : router.node_keys

Choose a reason for hiding this comment

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

Hi! 👋

This is related to a question I asked in https://github.com/redis-rb/redis-cluster-client/pull/364/files#r1724410379 .

I noticed that here too, the @router variable is being used directly instead of calling the router method. What's the reasoning behind this approach?

It seems that calling router would eliminate the need for the nil check. Is there a specific advantage to using @router directly in this context?

Also, I am waiting for this fix to be released!

Thanks in advance for your help!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that it would be better to delay initialization if any commands aren't sent to servers in the method.

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.

redis-clustering: NoMethodError: undefined method `node_keys' for nil:NilClass
3 participants