class RedisClient::SentinelConfig

def refresh_sentinels(sentinel_client)

def refresh_sentinels(sentinel_client)
  sentinel_response = sentinel_client.call("SENTINEL", "sentinels", @name, &@to_list_of_hash)
  sentinels = sentinel_response.map do |sentinel|
    { host: sentinel.fetch("ip"), port: Integer(sentinel.fetch("port")) }
  end
  new_sentinels = sentinels.select do |sentinel|
    @sentinel_configs.none? do |sentinel_config|
      sentinel_config.host == sentinel.fetch(:host) && sentinel_config.port == sentinel.fetch(:port)
    end
  end
  @sentinel_configs.concat sentinels_to_configs(new_sentinels)
end