summaryrefslogtreecommitdiff
path: root/plugins/jobs/drivers/amqp/redial.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jobs/drivers/amqp/redial.go')
-rw-r--r--plugins/jobs/drivers/amqp/redial.go27
1 files changed, 18 insertions, 9 deletions
diff --git a/plugins/jobs/drivers/amqp/redial.go b/plugins/jobs/drivers/amqp/redial.go
index 0b52a4d1..4f04484e 100644
--- a/plugins/jobs/drivers/amqp/redial.go
+++ b/plugins/jobs/drivers/amqp/redial.go
@@ -108,18 +108,27 @@ func (j *JobsConsumer) redialer() { //nolint:gocognit
j.Unlock()
case <-j.stopCh:
- err := j.publishChan.Close()
- if err != nil {
- j.log.Error("publish channel close", "error", err)
+ if j.publishChan != nil {
+ err := j.publishChan.Close()
+ if err != nil {
+ j.log.Error("publish channel close", "error", err)
+ }
}
- err = j.consumeChan.Close()
- if err != nil {
- j.log.Error("consume channel close", "error", err)
+
+ if j.consumeChan != nil {
+ err := j.consumeChan.Close()
+ if err != nil {
+ j.log.Error("consume channel close", "error", err)
+ }
}
- err = j.conn.Close()
- if err != nil {
- j.log.Error("amqp connection close", "error", err)
+ if j.conn != nil {
+ err := j.conn.Close()
+ if err != nil {
+ j.log.Error("amqp connection close", "error", err)
+ }
}
+
+ return
}
}
}()