Skip to content

Commit

Permalink
event_handler: Use proper ctx for post fail log
Browse files Browse the repository at this point in the history
Use the context containing proper information about the event for
logging. Previously, the logged error didn't contain any information
about the event, alert or the involved object.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
  • Loading branch information
darkowlzz committed Nov 22, 2023
1 parent 543b193 commit 7c1b417
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/server/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ func (s *EventServer) dispatchNotification(ctx context.Context, event *eventv1.E
}

go func(n notifier.Interface, e eventv1.Event) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
pctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
if err := n.Post(ctx, e); err != nil {
if err := n.Post(pctx, e); err != nil {
maskedErrStr, maskErr := masktoken.MaskTokenFromString(err.Error(), token)
if maskErr != nil {
err = maskErr
Expand Down

0 comments on commit 7c1b417

Please sign in to comment.