Close idle connections in influxdb outputs when reloading (#5912)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user