diff --git a/nodes/node_balancer/cmd/balancer.go b/nodes/node_balancer/cmd/balancer.go index e7fcb210..c0939b01 100644 --- a/nodes/node_balancer/cmd/balancer.go +++ b/nodes/node_balancer/cmd/balancer.go @@ -104,7 +104,7 @@ func (bpool *BlockchainPool) GetNextNode(blockchain string) *Node { // If we have an alive one, use it and store if its not the original one if np.Nodes[idx].IsAlive() { if i != next { - log.Printf("Mark the current one %d", uint64(idx)) + // Mark the current one atomic.StoreUint64(&np.Current, uint64(idx)) } // Pass nodes with low blocks diff --git a/nodes/node_balancer/cmd/routes.go b/nodes/node_balancer/cmd/routes.go index d6123c8e..d3004291 100644 --- a/nodes/node_balancer/cmd/routes.go +++ b/nodes/node_balancer/cmd/routes.go @@ -6,7 +6,6 @@ package cmd import ( "encoding/json" "fmt" - "log" "net/http" "strings" @@ -35,7 +34,6 @@ func lbHandler(w http.ResponseWriter, r *http.Request) { clientId := w.Header().Get(configs.MOONSTREAM_CLIENT_ID_HEADER) if clientId == "" { - log.Printf("Empty client id provided") // TODO(kompotkot): After all internal crawlers and services start // providing client id header, then replace to http.Error clientId = "none" @@ -48,7 +46,7 @@ func lbHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Unacceptable blockchain provided %s", blockchain), http.StatusBadRequest) return } - cpool.GetClientNode(clientId) + node = cpool.GetClientNode(clientId) if node == nil { node = blockchainPool.GetNextNode(blockchain) if node == nil {