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

15
internal/http_go1.11.go Normal file
View File

@@ -0,0 +1,15 @@
// +build !go1.12
package internal
import "net/http"
func CloseIdleConnections(c *http.Client) {
type closeIdler interface {
CloseIdleConnections()
}
if tr, ok := c.Transport.(closeIdler); ok {
tr.CloseIdleConnections()
}
}

9
internal/http_go1.12.go Normal file
View File

@@ -0,0 +1,9 @@
// +build go1.12
package internal
import "net/http"
func CloseIdleConnections(c *http.Client) {
c.CloseIdleConnections()
}