func()

in dialer.go [241:261]


func (s *SentinelDialer) subscribeToElections() (redis.PubSubConn, error) {
	result, err := s.doUntilSuccess(func(conn redis.Conn) (interface{}, error) {
		psc := redis.PubSubConn{Conn: conn}
		if err := psc.Subscribe("+switch-master"); err != nil {
			return psc, err
		}

		msg := psc.Receive()
		if _, ok := msg.(redis.Subscription); !ok {
			return psc, fmt.Errorf("redplex/dialer: expected subscription ack from sentinel, got: %+v", msg)
		}

		return psc, nil
	})

	if err != nil {
		return redis.PubSubConn{}, err
	}

	return result.(redis.PubSubConn), nil
}