sentinel.go
func (s *Sentinel) putToTop(addr string) {
	addrs := s.Addrs
	if addrs[0] == addr {
		// Already on top.
		return
	}
	newAddrs := []string{addr}
	for _, a := range addrs {
		if a == addr {
			continue
		}
		newAddrs = append(newAddrs, a)
	}
	s.Addrs = newAddrs
}
func (s *Sentinel) putToTop(addr string) {
	addrs := s.Addrs
	if addrs[0] == addr {
		// Already on top.
		return
	}
	newAddrs := []string{addr}
	for _, a := range addrs {
		if a == addr {
			continue
		}
		newAddrs = append(newAddrs, a)
	}
	s.Addrs = newAddrs
}
func ( s * Sentinel ) putToTop ( addr string ) { addrs := s . Addrs if addrs [ 0 ] == addr { // Already on top. return } newAddrs := [ ] string { addr } for _ , a := range addrs { if a == addr { continue } newAddrs = append ( newAddrs , a ) } s . Addrs = newAddrs }
// putToTop puts Sentinel address to the top of address list - this means
// that all next requests will use Sentinel on this address first.
//
// From Sentinel guidelines:
//
// The first Sentinel replying to the client request should be put at the
// start of the list, so that at the next reconnection, we'll try first
// the Sentinel that was reachable in the previous connection attempt,
// minimizing latency.
//
// Lock must be held by caller.
putToTop puts Sentinel address to the top of address list - this means that all next requests will use Sentinel on this address first . From Sentinel guidelines : The first Sentinel replying to the client request should be put at the start of the list so that at the next reconnection we ll try first the Sentinel that was reachable in the previous connection attempt minimizing latency . Lock must be held by caller .