Skip to content

Commit

Permalink
Simplify conditions in passing.go
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaroaleman committed Dec 19, 2017
1 parent e41126e commit b155591
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions registry/consul/passing.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ func passingServices(checks []*api.HealthCheck, status []string) []*api.HealthCh
// then check whether the agent is still alive and both the
// node and the service are not in maintenance mode.
for _, c := range checks {
if c.CheckID == "serfHealth" && c.Node == svc.Node && c.Status == "critical" {
if c.Node != svc.Node {
continue
}
if c.CheckID == "serfHealth" && c.Status == "critical" {
log.Printf("[DEBUG] consul: Skipping service %q since agent on node %q is down: %s", svc.ServiceID, svc.Node, c.Output)
goto skip
}
if c.CheckID == "_node_maintenance" && c.Node == svc.Node {
if c.CheckID == "_node_maintenance" {
log.Printf("[DEBUG] consul: Skipping service %q since node %q is in maintenance mode: %s", svc.ServiceID, svc.Node, c.Output)
goto skip
}
if c.CheckID == "_service_maintenance:"+svc.ServiceID && c.Node == svc.Node && c.Status == "critical" {
if c.CheckID == "_service_maintenance:"+svc.ServiceID && c.Status == "critical" {
log.Printf("[DEBUG] consul: Skipping service %q since it is in maintenance mode: %s", svc.ServiceID, c.Output)
goto skip
}
Expand Down

0 comments on commit b155591

Please sign in to comment.