Skip to content

Commit

Permalink
fix(relayer): fix queue log when error is nil (#15861)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed Feb 17, 2024
1 parent 4588f04 commit cbe7f9f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/relayer/pkg/queue/rabbitmq/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ func (r *RabbitMQ) connect() error {
r.conn = conn
r.ch = ch

r.connErrCh = r.conn.NotifyClose(make(chan *amqp.Error, 1))
r.connErrCh = r.conn.NotifyClose(make(chan *amqp.Error))

r.chErrCh = r.ch.NotifyClose(make(chan *amqp.Error, 1))
r.chErrCh = r.ch.NotifyClose(make(chan *amqp.Error))

r.subscriptionCtx, r.subscriptionCancel = context.WithCancel(context.Background())

Expand Down Expand Up @@ -208,10 +208,20 @@ func (r *RabbitMQ) Notify(ctx context.Context, wg *sync.WaitGroup) error {

return nil
case err := <-r.connErrCh:
slog.Error("rabbitmq notify close connection", "err", err.Error())
if err != nil {
slog.Error("rabbitmq notify close connection", "err", err.Error())
} else {
slog.Error("rabbitmq notify close connection")
}

return queue.ErrClosed
case err := <-r.chErrCh:
slog.Error("rabbitmq notify close channel", "err", err.Error())
if err != nil {
slog.Error("rabbitmq notify close channel", "err", err.Error())
} else {
slog.Error("rabbitmq notify close channel")
}

return queue.ErrClosed
case returnMsg := <-r.notifyReturnCh:
slog.Error("rabbitmq notify return", "id", returnMsg.MessageId, "err", returnMsg.ReplyText)
Expand Down

0 comments on commit cbe7f9f

Please sign in to comment.