Cosmetic and various other wordsmithing cleanups

This commit is contained in:
Sean Chittenden 2016-02-19 18:58:49 -08:00
parent 31de4290cf
commit 62785de865

View file

@ -154,12 +154,12 @@ func (sm *ServerManager) CycleFailedServers() {
func (sc *serverConfig) cycleServer() (servers []*server_details.ServerDetails) { func (sc *serverConfig) cycleServer() (servers []*server_details.ServerDetails) {
numServers := len(servers) numServers := len(servers)
if numServers < 2 { if numServers < 2 {
// No action required for zero or one server situations // No action required
return servers return servers
} }
newServers := make([]*server_details.ServerDetails, len(servers)+1)
var dequeuedServer *server_details.ServerDetails var dequeuedServer *server_details.ServerDetails
newServers := make([]*server_details.ServerDetails, len(servers)+1)
dequeuedServer, newServers = servers[0], servers[1:] dequeuedServer, newServers = servers[0], servers[1:]
servers = append(newServers, dequeuedServer) servers = append(newServers, dequeuedServer)
return servers return servers
@ -198,8 +198,8 @@ func (sm *ServerManager) GetNumServers() (numServers int) {
return numServers return numServers
} }
// getServerConfig shorthand method to hide the locking semantics of // getServerConfig is a convenience method to hide the locking semantics of
// atomic.Value // atomic.Value from the caller.
func (sm *ServerManager) getServerConfig() serverConfig { func (sm *ServerManager) getServerConfig() serverConfig {
return sm.serverConfigValue.Load().(serverConfig) return sm.serverConfigValue.Load().(serverConfig)
} }
@ -207,8 +207,7 @@ func (sm *ServerManager) getServerConfig() serverConfig {
// NewServerManager is the only way to safely create a new ServerManager // NewServerManager is the only way to safely create a new ServerManager
// struct. // struct.
// //
// NOTE(sean@): We don't simply pass in a consul.Client struct to avoid a // NOTE(sean@): We can not pass in *consul.Client due to an import cycle
// cyclic import
func NewServerManager(logger *log.Logger, shutdownCh chan struct{}) (sm *ServerManager) { func NewServerManager(logger *log.Logger, shutdownCh chan struct{}) (sm *ServerManager) {
sm = new(ServerManager) sm = new(ServerManager)
// Create the initial serverConfig // Create the initial serverConfig