func()

in dialer.go [145:168]


func (s *SentinelDialer) monitorMaster(cnx net.Conn, currentMaster string, closer <-chan struct{}) {
	backoff := backoff.NewExponentialBackOff()
	backoff.MaxInterval = time.Second * 10

	defer func() {
		cnx.Close()
		logrus.Infof("redplex/dialer: failed over from %s as it is no longer the cluster master", currentMaster)
	}()

	for {
		err := s.watchForReelection(backoff, currentMaster, closer)
		if err == nil {
			return
		}

		logrus.WithError(err).Info("redplex/dialer: error connecting to Redis sentinels")
		select {
		case <-time.After(backoff.NextBackOff()):
			continue
		case <-closer:
			return
		}
	}
}