From 7cc3b08f654e6e797c1935cf850a0db18ef2628a Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 1 Dec 2017 15:57:34 +0000 Subject: [PATCH] plugin/proxy: when HC fails increase fails (#1270) When we failing the healthcheck we should increate the fails for this host; which is the *bleeping* point of doing the HC in the first place. Add the missing atomic.Adds. Fixes #1247 --- plugin/pkg/healthcheck/healthcheck.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/pkg/healthcheck/healthcheck.go b/plugin/pkg/healthcheck/healthcheck.go index 870373fdd..29a904c34 100644 --- a/plugin/pkg/healthcheck/healthcheck.go +++ b/plugin/pkg/healthcheck/healthcheck.go @@ -123,6 +123,7 @@ func (uh *UpstreamHost) HealthCheckURL() { if err != nil { log.Printf("[WARNING] Host %s health check probe failed: %v", uh.Name, err) + atomic.AddInt32(&uh.Fails, 1) return } @@ -132,6 +133,7 @@ func (uh *UpstreamHost) HealthCheckURL() { if r.StatusCode < 200 || r.StatusCode >= 400 { log.Printf("[WARNING] Host %s health check returned HTTP code %d", uh.Name, r.StatusCode) + atomic.AddInt32(&uh.Fails, 1) return }