Skip to content
Snippets Groups Projects
Commit dfb3503b authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

test retries

parent ffe94f9d
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !773. Comments created here will be created in the context of that merge request.
...@@ -80,12 +80,17 @@ func NewEventService() (interfaces.Service, error) { ...@@ -80,12 +80,17 @@ func NewEventService() (interfaces.Service, error) {
} }
func connect(addr string) (*amqp.Connection, error) { func connect(addr string) (*amqp.Connection, error) {
conn, err := amqp.Dial(addr) retries := 60
if err != nil {
return nil, &customerrs.AMQPInitFailError{Action: "failed to connect to RabbitMQ", Err: err} for i := 0; i < retries; i++ {
conn, err := amqp.Dial(addr)
if err == nil {
return conn, nil
}
time.Sleep(2 * time.Second)
} }
return conn, nil return nil, &customerrs.AMQPInitFailError{Action: "failed to connect to RabbitMQ", Err: err}
} }
// Reconnect attempts to setup a new connection to the RabbitMQ server after an disconnect. // Reconnect attempts to setup a new connection to the RabbitMQ server after an disconnect.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment