6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/solid_redis/sentinel/resolve_service.rb', line 6
def call
@endpoints.each do |endpoint|
client = Config.new(**@specification.sentinel_client_options, **endpoint).new_client
target = resolve_target(client)
unless target
append_error(
:target_not_found,
"#{endpoint_label(endpoint)} does not know #{@specification.name.inspect}",
)
next
end
return {
target: target,
endpoint: endpoint,
discovered: discover_sentinels(client),
}
rescue SolidRedis::Error, KeyError, ArgumentError => error
append_error(:sentinel_unavailable, "#{endpoint_label(endpoint)}: #{error.message}")
sleep SentinelState::SENTINEL_DELAY
ensure
client&.close
end
nil
end
|