Skip to content

Commit

Permalink
lint: minor warns
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed May 15, 2022
1 parent e41bc60 commit f3b3ec8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions app/picker/random.go
Expand Up @@ -72,19 +72,18 @@ func (w *RandomWeighted) Nodes() map[string][]Node {
}

// Status return status of all nodes, true if all nodes are alive, false if at least one is dead and return list of dead nodes
func (w *RandomWeighted) Status() (bool, []string) {
func (w *RandomWeighted) Status() (ok bool, failed []string) {
w.lock.RLock()
defer w.lock.RUnlock()

var bad []string
for _, nodes := range w.nodes {
for _, node := range nodes {
if !node.alive {
bad = append(bad, node.Server)
failed = append(failed, node.Server)
}
}
}
return len(bad) == 0, bad
return len(failed) == 0, failed
}

// updateAlive runs periodic pings to all nodes, updates nodes
Expand Down
1 change: 0 additions & 1 deletion app/server/rlb_server.go
Expand Up @@ -207,5 +207,4 @@ func (s *RLBServer) statusCtrl(w http.ResponseWriter, r *http.Request) {

render.Status(r, http.StatusOK)
render.JSON(w, r, map[string]interface{}{"status": "ok"})
return
}
2 changes: 1 addition & 1 deletion app/server/rlb_server_test.go
Expand Up @@ -154,6 +154,6 @@ func (m *mockPicker) Nodes() map[string][]picker.Node {
return m.nodes
}

func (m *mockPicker) Status() (bool, []string) {
func (m *mockPicker) Status() (ok bool, failed []string) {
return true, []string{}
}

0 comments on commit f3b3ec8

Please sign in to comment.