Move initialization of the rebalanceTimer to New()
This commit is contained in:
parent
86d1bad541
commit
9b5dd7a785
|
@ -225,6 +225,7 @@ func New(logger *log.Logger, shutdownCh chan struct{}, clusterInfo ConsulCluster
|
||||||
sm.logger = logger
|
sm.logger = logger
|
||||||
sm.clusterInfo = clusterInfo // can't pass *consul.Client: import cycle
|
sm.clusterInfo = clusterInfo // can't pass *consul.Client: import cycle
|
||||||
sm.connPoolPinger = connPoolPinger // can't pass *consul.ConnPool: import cycle
|
sm.connPoolPinger = connPoolPinger // can't pass *consul.ConnPool: import cycle
|
||||||
|
sm.rebalanceTimer = time.NewTimer(clientRPCMinReuseDuration)
|
||||||
sm.shutdownCh = shutdownCh
|
sm.shutdownCh = shutdownCh
|
||||||
|
|
||||||
sc := serverConfig{}
|
sc := serverConfig{}
|
||||||
|
@ -440,8 +441,6 @@ func (sm *ServerManager) ResetRebalanceTimer() {
|
||||||
// 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() {
|
||||||
sm.rebalanceTimer = time.NewTimer(clientRPCMinReuseDuration)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-sm.rebalanceTimer.C:
|
case <-sm.rebalanceTimer.C:
|
||||||
|
|
Loading…
Reference in New Issue