From 7c1b417bc84d0eed65312470ba5b42ca8400646d Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 21 Nov 2023 17:17:39 +0000 Subject: [PATCH] event_handler: Use proper ctx for post fail log 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 --- internal/server/event_handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/server/event_handlers.go b/internal/server/event_handlers.go index cd22053db..f7b80dfc8 100644 --- a/internal/server/event_handlers.go +++ b/internal/server/event_handlers.go @@ -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