summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/healthchecks.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/reverseproxy/healthchecks.go')
-rw-r--r--modules/caddyhttp/reverseproxy/healthchecks.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/modules/caddyhttp/reverseproxy/healthchecks.go b/modules/caddyhttp/reverseproxy/healthchecks.go
index ee56f33..79f18fc 100644
--- a/modules/caddyhttp/reverseproxy/healthchecks.go
+++ b/modules/caddyhttp/reverseproxy/healthchecks.go
@@ -78,7 +78,6 @@ type ActiveHealthChecks struct {
// body of a healthy backend.
ExpectBody string `json:"expect_body,omitempty"`
- stopChan chan struct{}
httpClient *http.Client
bodyRegexp *regexp.Regexp
logger *zap.Logger
@@ -137,8 +136,7 @@ func (h *Handler) activeHealthChecker() {
select {
case <-ticker.C:
h.doActiveHealthCheckForAllHosts()
- case <-h.HealthChecks.Active.stopChan:
- // TODO: consider using a Context for cancellation instead
+ case <-h.ctx.Done():
ticker.Stop()
return
}
@@ -341,8 +339,8 @@ func (h *Handler) countFailure(upstream *Upstream) {
if err != nil {
h.HealthChecks.Passive.logger.Error("could not count failure",
zap.String("host", upstream.Dial),
- zap.Error(err),
- )
+ zap.Error(err))
+ return
}
// forget it later
@@ -357,8 +355,7 @@ func (h *Handler) countFailure(upstream *Upstream) {
if err != nil {
h.HealthChecks.Passive.logger.Error("could not forget failure",
zap.String("host", upstream.Dial),
- zap.Error(err),
- )
+ zap.Error(err))
}
}(upstream.Host, failDuration)
}