Skip to content

Commit

Permalink
fix(relayer): reconnect after notify close (#16329)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Mar 5, 2024
1 parent 7423ffa commit 8987156
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/relayer/pkg/queue/rabbitmq/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ func (r *RabbitMQ) Notify(ctx context.Context, wg *sync.WaitGroup) error {
slog.Error("rabbitmq notify close connection")
}

r.Close(ctx)

if err := r.connect(); err != nil {
slog.Error("error reconnecting to rabbitmq after notify closed", "err", err.Error())
return err
}

return queue.ErrClosed
case err := <-r.chErrCh:
if err != nil {
Expand All @@ -220,6 +227,13 @@ func (r *RabbitMQ) Notify(ctx context.Context, wg *sync.WaitGroup) error {
slog.Error("rabbitmq notify close channel")
}

r.Close(ctx)

if err := r.connect(); err != nil {
slog.Error("error reconnecting to rabbitmq after notify closed", "err", err.Error())
return err
}

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

0 comments on commit 8987156

Please sign in to comment.