summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index b418953..eaa7cbf 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -792,10 +792,15 @@ func (lb LoadBalancing) tryAgain(ctx caddy.Context, start time.Time, proxyErr er
}
// otherwise, wait and try the next available host
+ timer := time.NewTimer(time.Duration(lb.TryInterval))
select {
- case <-time.After(time.Duration(lb.TryInterval)):
+ case <-timer.C:
return true
case <-ctx.Done():
+ if !timer.Stop() {
+ // if the timer has been stopped then read from the channel
+ <-timer.C
+ }
return false
}
}