redis / redis-rb

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

Add NodeMightBeDown to redis client error mapping #1241

Closed learoyklinginsmith closed 9 months ago

learoyklinginsmith commented 9 months ago

We've experienced RedisClient::Cluster::NodeMightBeDown errors when scaling in our cluster mode enabled Elasticache clusters. This seems expected, but this error doesn't exist in the error map, so we receive an exception similar to the following:

/var/bundle/ruby/3.1.0/gems/redis-clustering-5.0.8/lib/redis/cluster/client.rb:89:in 'fetch': key not found: RedisClient::Cluster::NodeMightBeDown
Did you mean?  RedisClient::Cluster::ErrorCollection (KeyError)
from /var/bundle/ruby/3.1.0/gems/redis-clustering-5.0.8/lib/redis/cluster/client.rb:89:in `rescue in handle_errors'
from /var/bundle/ruby/3.1.0/gems/redis-clustering-5.0.8/lib/redis/cluster/client.rb:79:in `handle_errors'
from /var/bundle/ruby/3.1.0/gems/redis-clustering-5.0.8/lib/redis/cluster/client.rb:61:in `call_v'
from /var/bundle/ruby/3.1.0/gems/redis-5.0.8/lib/redis.rb:152:in `block in send_command'
from /var/bundle/ruby/3.1.0/gems/redis-5.0.8/lib/redis.rb:151:in `synchronize'
from /var/bundle/ruby/3.1.0/gems/redis-5.0.8/lib/redis.rb:151:in `send_command'
from /var/bundle/ruby/3.1.0/gems/redis-5.0.8/lib/redis/commands/strings.rb:95:in `set'

This adds the NodeMightBeDown error to the error mapping so it can be fetched as expected.

byroot commented 9 months ago

Merged as c6fa9f4a0397d175bf93b85cec1ead9ca868c4b6