Merge pull request #605 from weaveworks/604-close-idle-http

Close idle http connections when we stop a Http Publisher.
This commit is contained in:
Peter Bourgon
2015-10-29 13:45:12 +01:00

View File

@@ -119,7 +119,12 @@ func (p HTTPPublisher) Publish(r io.Reader) error {
}
// Stop implements Publisher
func (p HTTPPublisher) Stop() {}
func (p *HTTPPublisher) Stop() {
// We replace the HTTPPublishers pretty regularly, so we need to ensure the
// underlying connections get closed, or we end up with lots of idle
// goroutines on the server (see #604)
p.client.Transport.(*http.Transport).CloseIdleConnections()
}
// AuthorizationHeader returns a value suitable for an HTTP Authorization
// header, based on the passed token string.