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 579e536f58
commit 9eb6481d73
1 changed files with 4 additions and 4 deletions

View File

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