Skip to content

Commit

Permalink
fix: close resp body
Browse files Browse the repository at this point in the history
Signed-off-by: testwill <[email protected]>
  • Loading branch information
testwill authored and tristanmorgan committed Sep 4, 2024
1 parent ccb2e62 commit c20a401
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions registry/custom/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ func customRoutes(cfg *config.Custom, ch chan string) {
for {
log.Printf("[DEBUG] Custom Registry starting request %s \n", time.Now())
resp, err := client.Do(req)
if resp != nil {
defer func() {
if err := resp.Body.Close(); err != nil {
log.Printf("Error Can not close HTTP resp body - %s -%s \n", URL, err.Error())
}
}()
}
if err != nil {
ch <- fmt.Sprintf("Error Sending HTTPs Request To Custom be - %s -%s", URL, err.Error())
time.Sleep(cfg.PollInterval)
Expand Down

0 comments on commit c20a401

Please sign in to comment.