Address possible goroutine leak in notification library
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
f132ff7702
commit
269286192d
1 changed files with 2 additions and 0 deletions
|
@ -53,6 +53,7 @@ type httpStatusListener interface {
|
||||||
func (hs *httpSink) Write(events ...Event) error {
|
func (hs *httpSink) Write(events ...Event) error {
|
||||||
hs.mu.Lock()
|
hs.mu.Lock()
|
||||||
defer hs.mu.Unlock()
|
defer hs.mu.Unlock()
|
||||||
|
defer hs.client.Transport.(*headerRoundTripper).CloseIdleConnections()
|
||||||
|
|
||||||
if hs.closed {
|
if hs.closed {
|
||||||
return ErrSinkClosed
|
return ErrSinkClosed
|
||||||
|
@ -83,6 +84,7 @@ func (hs *httpSink) Write(events ...Event) error {
|
||||||
|
|
||||||
return fmt.Errorf("%v: error posting: %v", hs, err)
|
return fmt.Errorf("%v: error posting: %v", hs, err)
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
// The notifier will treat any 2xx or 3xx response as accepted by the
|
// The notifier will treat any 2xx or 3xx response as accepted by the
|
||||||
// endpoint.
|
// endpoint.
|
||||||
|
|
Loading…
Reference in a new issue