class Redis::Client::Connector::Sentinel

def check(client)

def check(client)
  # Check the instance is really of the role we are looking for.
  # We can't assume the command is supported since it was introduced
  # recently and this client should work with old stuff.
  begin
    role = client.call([:role])[0]
  rescue Redis::CommandError
    # Assume the test is passed if we can't get a reply from ROLE...
    role = @role
  end
  if role != @role
    client.disconnect
    raise ConnectionError, "Instance role mismatch. Expected #{@role}, got #{role}."
  end
end