Skip to content

Commit 00a6a00

Browse files
authored
Fix command information loading logic (#56)
1 parent 6f0e700 commit 00a6a00

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/redis_client/cluster/command.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@ class RedisClient
77
class Cluster
88
class Command
99
class << self
10-
def load(nodes)
11-
errors = nodes&.map do |node|
10+
def load(nodes) # rubocop:disable Metrics/MethodLength
11+
errors = []
12+
cmd = nil
13+
nodes&.each do |node|
14+
break unless cmd.nil?
15+
1216
reply = node.call('COMMAND')
1317
details = parse_command_details(reply)
14-
return ::RedisClient::Cluster::Command.new(details)
15-
rescue ::RedisClient::ConnectionError, ::RedisClient::CommandError => e
16-
e
18+
cmd = ::RedisClient::Cluster::Command.new(details)
19+
rescue ::RedisClient::Error => e
20+
errors << e
1721
end
1822

23+
return cmd unless cmd.nil?
24+
1925
raise ::RedisClient::Cluster::InitialSetupError, errors
2026
end
2127

0 commit comments

Comments
 (0)