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

Commit

Permalink
Merge pull request #72 from cloudflare/bug/close-connections
Browse files Browse the repository at this point in the history
Bugfix: make sure to close http connections
  • Loading branch information
lspgn committed Jul 7, 2020
2 parents 2a50540 + 2d9e8a0 commit 78f7a6e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/gortr/gortr.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ func (s *state) fetchFile(file string) ([]byte, error) {
if err != nil {
return nil, err
}

if fhttp.Body != nil {
defer fhttp.Body.Close()
}
defer client.CloseIdleConnections()
RefreshStatusCode.WithLabelValues(file, fmt.Sprintf("%d", fhttp.StatusCode)).Inc()

if fhttp.StatusCode == 304 {
Expand Down

0 comments on commit 78f7a6e

Please sign in to comment.