Initialize the rebalancce to clientRPCMinReuseDuration

In an earlier version there was a channel to notify when a new server was added, however this has long since been removed.  Just default to the sane value of 2min before the first rebalance calc takes place.

Pointed out by: slackpad
This commit is contained in:
Sean Chittenden 2016-03-25 13:46:18 -07:00
parent 4fec6a9608
commit 58246fcc0b
1 changed files with 1 additions and 6 deletions

View File

@ -31,11 +31,6 @@ const (
// queries are sent over an established connection to a single server // queries are sent over an established connection to a single server
clientRPCMinReuseDuration = 120 * time.Second clientRPCMinReuseDuration = 120 * time.Second
// initialRebalanceTimeout is the initial value for the
// rebalanceTimer. This value is discarded immediately after the
// client becomes aware of the first server.
initialRebalanceTimeout = 24 * time.Hour
// Limit the number of new connections a server receives per second // Limit the number of new connections a server receives per second
// for connection rebalancing. This limit caps the load caused by // for connection rebalancing. This limit caps the load caused by
// continual rebalancing efforts when a cluster is in equilibrium. A // continual rebalancing efforts when a cluster is in equilibrium. A
@ -299,7 +294,7 @@ func (sm *ServerManager) refreshServerRebalanceTimer(timer *time.Timer) time.Dur
// the list. The order of the server list must be shuffled periodically to // the list. The order of the server list must be shuffled periodically to
// distribute load across all known and available consul servers. // distribute load across all known and available consul servers.
func (sm *ServerManager) Start() { func (sm *ServerManager) Start() {
var rebalanceTimer *time.Timer = time.NewTimer(initialRebalanceTimeout) var rebalanceTimer *time.Timer = time.NewTimer(clientRPCMinReuseDuration)
var rebalanceTaskDispatched int32 var rebalanceTaskDispatched int32
func() { func() {