summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lahaye <mail@chrislahaye.com>2022-10-24 19:58:30 +0200
committerGitHub <noreply@github.com>2022-10-24 11:58:30 -0600
commitbbe366316771ea23381a473a528e71a72a7148a5 (patch)
tree95e91293f76430e85fcccf798d2782f3e137f975
parented503118dd8bd2dda2e780bdf7a0ada74338a462 (diff)
caddyconfig: Fix httploader leak from unused responses (#5159)
fixes #5158 Signed-off-by: Chris Lahaye <mail@chrislahaye.com> Signed-off-by: Chris Lahaye <mail@chrislahaye.com>
-rw-r--r--caddyconfig/httploader.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/caddyconfig/httploader.go b/caddyconfig/httploader.go
index f199219..04dec34 100644
--- a/caddyconfig/httploader.go
+++ b/caddyconfig/httploader.go
@@ -134,16 +134,16 @@ func doHttpCallWithRetries(ctx caddy.Context, client *http.Client, request *http
var err error
const maxAttempts = 10
- // attempt up to 10 times
for i := 0; i < maxAttempts; i++ {
resp, err = attemptHttpCall(client, request)
if err != nil && i < maxAttempts-1 {
- // wait 500ms before reattempting, or until context is done
select {
case <-time.After(time.Millisecond * 500):
case <-ctx.Done():
return resp, ctx.Err()
}
+ } else {
+ break
}
}