Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit 78f7a6e

Browse files
authored
Merge pull request #72 from cloudflare/bug/close-connections
Bugfix: make sure to close http connections
2 parents 2a50540 + 2d9e8a0 commit 78f7a6e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/gortr/gortr.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ func (s *state) fetchFile(file string) ([]byte, error) {
222222
if err != nil {
223223
return nil, err
224224
}
225-
225+
if fhttp.Body != nil {
226+
defer fhttp.Body.Close()
227+
}
228+
defer client.CloseIdleConnections()
226229
RefreshStatusCode.WithLabelValues(file, fmt.Sprintf("%d", fhttp.StatusCode)).Inc()
227230

228231
if fhttp.StatusCode == 304 {

0 commit comments

Comments
 (0)