Skip to content

Commit c365652

Browse files
authored
Merge pull request #28 from threefoldtech/fix-too-many-open-files
close response body on getting zos config
2 parents 2ffb769 + 3e4e38f commit c365652

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/environment/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package environment
33
import (
44
"encoding/json"
55
"fmt"
6-
"io"
76
"net/http"
87
"sort"
98
"strings"
@@ -84,7 +83,9 @@ func getConfig(run RunMode, url string, httpClient *http.Client) (ext Config, er
8483
}
8584

8685
defer func() {
87-
_, _ = io.ReadAll(response.Body)
86+
if response != nil && response.Body != nil {
87+
response.Body.Close()
88+
}
8889
}()
8990

9091
if response.StatusCode != http.StatusOK {

0 commit comments

Comments
 (0)