mirror of https://github.com/status-im/consul.git
rebalanceTimer may be nil during initialization
When first starting the server manager, it's possible that the rebalanceTimer in serverConfig will be nil, test accordingly.
This commit is contained in:
parent
a7091b0837
commit
e6c27325d9
|
@ -292,7 +292,11 @@ func (sc *serverConfig) resetRebalanceTimer(sm *ServerManager) {
|
|||
connRebalanceTimeout := lib.RateScaledInterval(clusterWideRebalanceConnsPerSec, connReuseLowWatermarkDuration, numLANMembers)
|
||||
sm.logger.Printf("[DEBUG] consul: connection will be rebalanced in %v", connRebalanceTimeout)
|
||||
|
||||
sc.rebalanceTimer.Reset(connRebalanceTimeout)
|
||||
if sc.rebalanceTimer == nil {
|
||||
sc.rebalanceTimer = time.NewTimer(connRebalanceTimeout)
|
||||
} else {
|
||||
sc.rebalanceTimer.Reset(connRebalanceTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
// StartServerManager is used to start and manage the task of automatically
|
||||
|
|
Loading…
Reference in New Issue