Use config convenience method to get config

'cause ELETTHECOMPILERSDOTHEWORK.  I don't need that cluttering up the subconscious with more complexity.
This commit is contained in:
Sean Chittenden 2016-02-19 18:56:15 -08:00
parent ed7fee7a3c
commit ffcd939feb

View file

@ -96,7 +96,7 @@ type ServerManager struct {
func (sm *ServerManager) AddServer(server *server_details.ServerDetails) {
sm.serverConfigLock.Lock()
defer sm.serverConfigLock.Unlock()
serverCfg := sm.serverConfigValue.Load().(serverConfig)
serverCfg := sm.getServerConfig()
// Check if this server is known
found := false
@ -126,7 +126,7 @@ func (sm *ServerManager) AddServer(server *server_details.ServerDetails) {
func (sm *ServerManager) CycleFailedServers() {
sm.serverConfigLock.Lock()
defer sm.serverConfigLock.Unlock()
serverCfg := sm.serverConfigValue.Load().(serverConfig)
serverCfg := sm.getServerConfig()
for i := range serverCfg.servers {
failCount := atomic.LoadUint64(&(serverCfg.servers[i].Disabled))
@ -213,7 +213,7 @@ func (sm *ServerManager) NotifyFailedServer(server *server_details.ServerDetails
func (sm *ServerManager) RebalanceServers() {
sm.serverConfigLock.Lock()
defer sm.serverConfigLock.Unlock()
serverCfg := sm.serverConfigValue.Load().(serverConfig)
serverCfg := sm.getServerConfig()
// 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
@ -230,7 +230,7 @@ func (sm *ServerManager) RebalanceServers() {
func (sm *ServerManager) RemoveServer(server *server_details.ServerDetails) {
sm.serverConfigLock.Lock()
defer sm.serverConfigLock.Unlock()
serverCfg := sm.serverConfigValue.Load().(serverConfig)
serverCfg := sm.getServerConfig()
// Remove the server if known
n := len(serverCfg.servers)