Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rboyer committed Nov 30, 2022
1 parent 65c70e8 commit 4372a52
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions agent/grpc-external/services/peerstream/subscription_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,11 @@ var statusScores = map[string]int{
api.HealthPassing: 4,
}

func isStatusBetter(curr, next string) bool {
return statusScores[next] < statusScores[curr]
func getMostImportantStatus(a, b string) string {
if statusScores[a] < statusScores[b] {
return a
}
return b
}

func flattenChecks(
Expand All @@ -696,9 +699,7 @@ func flattenChecks(
healthStatus = api.HealthMaint
break // always wins
}
if isStatusBetter(healthStatus, chk.Status) {
healthStatus = chk.Status
}
healthStatus = getMostImportantStatus(healthStatus, chk.Status)
}
}

Expand Down

0 comments on commit 4372a52

Please sign in to comment.