Skip to content

Commit

Permalink
Round flow to the left
Browse files Browse the repository at this point in the history
  • Loading branch information
jjngx authored and haywoodsh committed Nov 16, 2022
1 parent dcebe1c commit 6ba4114
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/healthcheck/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ type HostStats struct {
func countStats(upstreams *client.Upstreams, upstreamNames []string) HostStats {
total, up := 0, 0
for name, u := range *upstreams {
if slices.Contains(upstreamNames, name) {
for _, p := range u.Peers {
total++
if strings.ToLower(p.State) != "up" {
continue
}
up++
if !slices.Contains(upstreamNames, name) {
continue
}
for _, p := range u.Peers {
total++
if strings.ToLower(p.State) != "up" {
continue
}
up++
}
}

unhealthy := total - up
return HostStats{
Total: total,
Expand Down

0 comments on commit 6ba4114

Please sign in to comment.