Prevent connection leak by closing unused connections in amqp output (#4924)

This commit is contained in:
Greg
2018-10-25 23:37:18 -07:00
committed by Daniel Nelson
parent 133fabc672
commit 21208d2686
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -249,6 +249,7 @@ func (q *AMQP) Write(metrics []telegraf.Metric) error {
if q.sentMessages >= q.MaxMessages && q.MaxMessages > 0 {
log.Printf("D! Output [amqp] sent MaxMessages; closing connection")
q.client.Close()
q.client = nil
}
+1 -1
View File
@@ -55,7 +55,7 @@ func Connect(config *ClientConfig) (*client, error) {
log.Printf("D! Output [amqp] connected to %q", broker)
break
}
log.Printf("D! Output [amqp] error connecting to %q", broker)
log.Printf("D! Output [amqp] error connecting to %q - %s", broker, err.Error())
}
if client.conn == nil {