Skip to content

Commit

Permalink
pubsub/rabbitmq: return error if reconnect errors in Init
Browse files Browse the repository at this point in the history
We should always return the error if we fail to connection during the
Init of a Component. This is because failing to do so has downstream
effects whereby a component is considered healthy when it is not.

Re-attempting an Init or otherwise whould be handled by the runtime,
rather than on a per-component basis.

Signed-off-by: joshvanl <[email protected]>
  • Loading branch information
JoshVanL committed Oct 27, 2023
1 parent 5384d54 commit 8efc1a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pubsub/rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 8efc1a1

Please sign in to comment.