Commit 7cc3b08f authored by Miek Gieben's avatar Miek Gieben Committed by GitHub

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
parent 0d103ff5
...@@ -123,6 +123,7 @@ func (uh *UpstreamHost) HealthCheckURL() { ...@@ -123,6 +123,7 @@ func (uh *UpstreamHost) HealthCheckURL() {
if err != nil { if err != nil {
log.Printf("[WARNING] Host %s health check probe failed: %v", uh.Name, err) log.Printf("[WARNING] Host %s health check probe failed: %v", uh.Name, err)
atomic.AddInt32(&uh.Fails, 1)
return return
} }
...@@ -132,6 +133,7 @@ func (uh *UpstreamHost) HealthCheckURL() { ...@@ -132,6 +133,7 @@ func (uh *UpstreamHost) HealthCheckURL() {
if r.StatusCode < 200 || r.StatusCode >= 400 { if r.StatusCode < 200 || r.StatusCode >= 400 {
log.Printf("[WARNING] Host %s health check returned HTTP code %d", uh.Name, r.StatusCode) log.Printf("[WARNING] Host %s health check returned HTTP code %d", uh.Name, r.StatusCode)
atomic.AddInt32(&uh.Fails, 1)
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment