From 9c18bb5f1c721a46676a8ee869eab8d51dda6a00 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Fri, 25 Mar 2016 13:06:59 -0700 Subject: [PATCH] Comment updates --- consul/server_manager/server_manager.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/consul/server_manager/server_manager.go b/consul/server_manager/server_manager.go index 0f935c0b62..9d68bd14c6 100644 --- a/consul/server_manager/server_manager.go +++ b/consul/server_manager/server_manager.go @@ -232,7 +232,8 @@ func (sm *ServerManager) NumServers() (numServers int) { // Elsewhere we rely on the position in the server list as a hint regarding // the stability of a server relative to its position in the server list. // Servers at or near the front of the list are more stable than servers near -// the end of the list. +// the end of the list. Unhealthy servers are removed when serf notices the +// server has been deregistered. func (sm *ServerManager) RebalanceServers() { sm.serverConfigLock.Lock() defer sm.serverConfigLock.Unlock() @@ -241,9 +242,7 @@ func (sm *ServerManager) RebalanceServers() { newServers := make([]*server_details.ServerDetails, len(serverCfg.servers)) copy(newServers, serverCfg.servers) - // Shuffle the server list on server join. Servers are selected from - // the head of the list and are moved to the end of the list on - // failure. + // Shuffle the server list for i := len(serverCfg.servers) - 1; i > 0; i-- { j := rand.Int31n(int32(i + 1)) newServers[i], newServers[j] = newServers[j], newServers[i]