Skip to content

Commit

Permalink
feat: retry failed eventbus message publishing (#2162)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Wang <[email protected]>

Signed-off-by: Derek Wang <[email protected]>
  • Loading branch information
whynowy committed Sep 10, 2022
1 parent 7e424dc commit e52ad74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion eventsources/eventing.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ func (e *EventSourceAdaptor) run(ctx context.Context, servers map[apicommon.Even
Body: eventBody,
}

if err = e.eventBusConn.Publish(ctx, msg); err != nil {
if err = common.Connect(&common.DefaultBackoff, func() error {
return e.eventBusConn.Publish(ctx, msg)
}); err != nil {
logger.Errorw("failed to publish an event", zap.Error(err), zap.String(logging.LabelEventName,
s.GetEventName()), zap.Any(logging.LabelEventSourceType, s.GetEventSourceType()))
e.metrics.EventSentFailed(s.GetEventSourceName(), s.GetEventName())
Expand Down

0 comments on commit e52ad74

Please sign in to comment.