Skip to content
Snippets Groups Projects

Resolve "Investigate GitLab-CI services don't reach each other"

1 file
+ 4
1
Compare changes
  • Side-by-side
  • Inline
@@ -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.
Loading