From d47d1a7aad5b97fdb2f0ed1945dd5fc090bf7aaf Mon Sep 17 00:00:00 2001 From: Josh van Leeuwen Date: Fri, 27 Oct 2023 18:38:43 +0100 Subject: [PATCH] pubsub/rabbitmq: return error if reconnect errors in Init (#3198) Signed-off-by: joshvanl Signed-off-by: Bernd Verst Co-authored-by: Bernd Verst --- 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 }