mirror of https://github.com/hashicorp/consul
Relocate saveServerConfig next to getServerConfig
Requested by: slackpadpull/1873/head
parent
b00db393e7
commit
24eb274860
|
@ -168,6 +168,12 @@ func (sm *ServerManager) getServerConfig() serverConfig {
|
||||||
return sm.serverConfigValue.Load().(serverConfig)
|
return sm.serverConfigValue.Load().(serverConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// saveServerConfig is a convenience method which hides the locking semantics
|
||||||
|
// of atomic.Value from the caller.
|
||||||
|
func (sm *ServerManager) saveServerConfig(sc serverConfig) {
|
||||||
|
sm.serverConfigValue.Store(sc)
|
||||||
|
}
|
||||||
|
|
||||||
// New is the only way to safely create a new ServerManager struct.
|
// New is the only way to safely create a new ServerManager struct.
|
||||||
func New(logger *log.Logger, shutdownCh chan struct{}, clusterInfo ConsulClusterInfo) (sm *ServerManager) {
|
func New(logger *log.Logger, shutdownCh chan struct{}, clusterInfo ConsulClusterInfo) (sm *ServerManager) {
|
||||||
// NOTE(sean@): Can't pass *consul.Client due to an import cycle
|
// NOTE(sean@): Can't pass *consul.Client due to an import cycle
|
||||||
|
@ -287,12 +293,6 @@ func (sm *ServerManager) refreshServerRebalanceTimer(timer *time.Timer) time.Dur
|
||||||
return connRebalanceTimeout
|
return connRebalanceTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
// saveServerConfig is a convenience method which hides the locking semantics
|
|
||||||
// of atomic.Value from the caller.
|
|
||||||
func (sm *ServerManager) saveServerConfig(sc serverConfig) {
|
|
||||||
sm.serverConfigValue.Store(sc)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start is used to start and manage the task of automatically shuffling and
|
// Start is used to start and manage the task of automatically shuffling and
|
||||||
// rebalancing the list of consul servers. This maintenance only happens
|
// rebalancing the list of consul servers. This maintenance only happens
|
||||||
// periodically based on the expiration of the timer. Failed servers are
|
// periodically based on the expiration of the timer. Failed servers are
|
||||||
|
|
Loading…
Reference in New Issue