Skip to content

Commit

Permalink
Wrong place to set headers
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjohansen committed Jul 10, 2023
1 parent 69ef0b3 commit 30fdc1b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,12 @@ func (d *Dispatcher) dispatch(ctx context.Context, msg amqp.Delivery, ceClient c
args := &dispatcher.ReportArgs{EventType: event.Type()}
if err = d.Reporter.ReportEventCount(args, statusCode); err != nil {
logging.FromContext(ctx).Errorf("Something happened: %v", err)

msg.Headers["knativeerrordest"] = d.SubscriberURL
msg.Headers["knativeerrorcode"] = statusCode
}
}

if !isSuccess {
logging.FromContext(ctx).Warnf("Failed to deliver to %q", d.SubscriberURL)
msg.Headers["knativeerrordest"] = d.SubscriberURL
if err = msg.Nack(false, true); err != nil {
logging.FromContext(ctx).Warn("failed to NACK event: ", err)
}
Expand Down

0 comments on commit 30fdc1b

Please sign in to comment.