Close idle connections in influxdb outputs when reloading (#5912)

This commit is contained in:
Daniel Nelson
2019-05-31 16:55:31 -07:00
committed by GitHub
parent 9cc3b3d234
commit 17d66b864c
8 changed files with 48 additions and 0 deletions

View File

@@ -307,3 +307,7 @@ func makeWriteURL(loc url.URL, org, bucket string) (string, error) {
loc.RawQuery = params.Encode()
return loc.String(), nil
}
func (c *httpClient) Close() {
internal.CloseIdleConnections(c.client)
}

View File

@@ -74,6 +74,7 @@ type Client interface {
Write(context.Context, []telegraf.Metric) error
URL() string // for logging
Close()
}
type InfluxDB struct {
@@ -137,6 +138,9 @@ func (i *InfluxDB) Connect() error {
}
func (i *InfluxDB) Close() error {
for _, client := range i.clients {
client.Close()
}
return nil
}