chore: added defer instructions
This commit is contained in:
parent
72e5b16b7a
commit
c2e79fdcbf
@ -66,6 +66,8 @@ func FetchData(wc *WeatherConfig, city string) (Data, error) {
|
|||||||
return Data{}, err
|
return Data{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer r.Body.Close()
|
||||||
|
|
||||||
b, err := ioutil.ReadAll(r.Body)
|
b, err := ioutil.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Data{}, err
|
return Data{}, err
|
||||||
@ -95,6 +97,7 @@ func SendToInflux(wc *WeatherConfig, d Data) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer httpClient.Close()
|
||||||
|
|
||||||
bp, err := client.NewBatchPoints(client.BatchPointsConfig{
|
bp, err := client.NewBatchPoints(client.BatchPointsConfig{
|
||||||
Database: wc.InfluxDB,
|
Database: wc.InfluxDB,
|
||||||
|
Loading…
Reference in New Issue
Block a user