Close client connection when done.
This will take care of cleaning all the lingering connections that would have been left open which would eventually trigger a too many files error or an OOM.
This commit is contained in:
parent
84463e2815
commit
aa09e7c660
1 changed files with 1 additions and 0 deletions
|
@ -201,6 +201,7 @@ func (c *Client) getStatistics() (*Stats, error) {
|
|||
return nil, fmt.Errorf("an error has occured during retrieving PI-Hole statistics: %w", err)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to read PI-Hole statistics HTTP response: %w", err)
|
||||
|
|
Loading…
Reference in a new issue