fix(inputs.amqp_consumer): Fix panic on Stop() if not connected successfully (#12817)
This commit is contained in:
parent
603cdfb620
commit
e58891be11
|
|
@ -439,6 +439,10 @@ func (a *AMQPConsumer) onDelivery(track telegraf.DeliveryInfo) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AMQPConsumer) Stop() {
|
func (a *AMQPConsumer) Stop() {
|
||||||
|
// We did not connect successfully so there is nothing to do here.
|
||||||
|
if a.conn == nil || a.conn.IsClosed() {
|
||||||
|
return
|
||||||
|
}
|
||||||
a.cancel()
|
a.cancel()
|
||||||
a.wg.Wait()
|
a.wg.Wait()
|
||||||
err := a.conn.Close()
|
err := a.conn.Close()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue