redis / redis-rb

A Ruby client library for Redis
MIT License
3.96k stars 1.03k forks source link

redis-clustering: NoMethodError: undefined method `node_keys' for nil:NilClass #1282

Closed ccutrer closed 3 months ago

ccutrer commented 3 months ago

With a recent redis-cluster-client commit, @router can be nil, so https://github.com/redis/redis-rb/blob/v5.2.0/cluster/lib/redis/cluster/client.rb#L56 is failing.

#<NoMethodError: undefined method `node_keys' for nil:NilClass

        @router.node_keys.join(' ')
               ^^^^^^^^^^>
/var/web/canvas/shared/bundle/ruby/3.1.0/gems/redis-clustering-5.2.0/lib/redis/cluster/client.rb:56:in `id'
/var/web/canvas/shared/bundle/ruby/3.1.0/gems/redis-5.2.0/lib/redis.rb:111:in `id'
/var/web/canvas/shared/bundle/ruby/3.1.0/gems/redis-5.2.0/lib/redis.rb:115:in `inspect'
(irb):8:in `<top (required)>'

is a full backtrace.

Note that in redis-cluster-client's inspect method, it checks if @router is nil before using it now.

supercaracal commented 3 months ago

Sorry, I'll fix it ASAP.