diff options
author | 2017-12-01 15:57:34 +0000 | |
---|---|---|
committer | 2017-12-01 15:57:34 +0000 | |
commit | 7cc3b08f654e6e797c1935cf850a0db18ef2628a (patch) | |
tree | 6a3d2e297dee378babcff46c25d7f20c6c18dab8 | |
parent | 0d103ff57ca1b65ec9610b6992e14277e685eb70 (diff) | |
download | coredns-7cc3b08f654e6e797c1935cf850a0db18ef2628a.tar.gz coredns-7cc3b08f654e6e797c1935cf850a0db18ef2628a.tar.zst coredns-7cc3b08f654e6e797c1935cf850a0db18ef2628a.zip |
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
-rw-r--r-- | plugin/pkg/healthcheck/healthcheck.go | 2 |
1 files changed, 2 insertions, 0 deletions
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 } |