From 5889413a6630da3adb540dcde98ac4497ef365c1 Mon Sep 17 00:00:00 2001 From: Neil Schark <neil.schark@h-da.de> Date: Wed, 6 Mar 2024 10:21:06 +0000 Subject: [PATCH] retires logs --- controller/eventService/Service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controller/eventService/Service.go b/controller/eventService/Service.go index 3ab30a428..b511c2002 100644 --- a/controller/eventService/Service.go +++ b/controller/eventService/Service.go @@ -13,6 +13,7 @@ import ( amqp "github.com/rabbitmq/amqp091-go" "github.com/sethvargo/go-retry" + "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" ) @@ -80,6 +81,7 @@ func NewEventService() (interfaces.Service, error) { } func connect(addr string) (*amqp.Connection, error) { + var err error retries := 60 for i := 0; i < retries; i++ { @@ -87,10 +89,11 @@ func connect(addr string) (*amqp.Connection, error) { if err == nil { return conn, nil } + logrus.Info("could not connect to RabbitMQ. Retrying in 2 seconds.") time.Sleep(2 * time.Second) } - return nil, &customerrs.AMQPInitFailError{Action: "failed to connect to RabbitMQ", Err: err} + return nil, &customerrs.AMQPInitFailError{Action: "finally failed to connect to RabbitMQ", Err: err} } // Reconnect attempts to setup a new connection to the RabbitMQ server after an disconnect. -- GitLab