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
This commit is contained in:
Miek Gieben
2017-12-01 15:57:34 +00:00
committed by GitHub
parent 0d103ff57c
commit 7cc3b08f65

View File

@@ -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
}