class Redis::Client::Connector::Sentinel
def sentinel_detect
def sentinel_detect @sentinels.each do |sentinel| client = Client.new(@options.merge({ host: sentinel[:host] || sentinel["host"], port: sentinel[:port] || sentinel["port"], username: sentinel[:username] || sentinel["username"], password: sentinel[:password] || sentinel["password"], reconnect_attempts: 0 })) begin if result = yield(client) # This sentinel responded. Make sure we ask it first next time. @sentinels.delete(sentinel) @sentinels.unshift(sentinel) return result end rescue BaseConnectionError ensure client.disconnect end end raise CannotConnectError, "No sentinels available." end