Skip to content

Commit

Permalink
fix(outputs/amqp): Close the last connection when writing error to av…
Browse files Browse the repository at this point in the history
…oid connection leaks (#10360)

(cherry picked from commit 0b96d40)
  • Loading branch information
stitchcula authored and reimda committed Jan 27, 2022
1 parent 44983e3 commit 27af65f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/outputs/amqp/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ func (q *AMQP) Write(metrics []telegraf.Metric) error {
return err
}
} else {
if err := q.client.Close(); err != nil {
q.Log.Errorf("Closing connection failed: %v", err)
}
q.client = nil
return err
}
Expand Down

0 comments on commit 27af65f

Please sign in to comment.