mirror of
https://github.com/eko/pihole-exporter.git
synced 2024-11-21 11:05:22 +01:00
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
@ -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)
|
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)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to read PI-Hole statistics HTTP response: %w", err)
|
return nil, fmt.Errorf("unable to read PI-Hole statistics HTTP response: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user