From c23b191f6e7cd65cf50ef638467a99963fca1421 Mon Sep 17 00:00:00 2001 From: Josh van Leeuwen Date: Fri, 27 Oct 2023 19:13:34 +0100 Subject: [PATCH] [1.12] pubsub/rabbitmq: return error if reconnect errors in Init (#3199) Signed-off-by: joshvanl --- pubsub/rabbitmq/rabbitmq.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubsub/rabbitmq/rabbitmq.go b/pubsub/rabbitmq/rabbitmq.go index 1585523d4a..63d6e080f7 100644 --- a/pubsub/rabbitmq/rabbitmq.go +++ b/pubsub/rabbitmq/rabbitmq.go @@ -154,10 +154,10 @@ func (r *rabbitMQ) Init(_ context.Context, metadata pubsub.Metadata) error { r.metadata = meta - r.reconnect(0) - // We do not return error on reconnect because it can cause problems if init() happens - // right at the restart window for service. So, we try it now but there is logic in the - // code to reconnect as many times as needed. + if err := r.reconnect(0); err != nil { + return err + } + return nil }