diff --git a/internal/server/event_handlers.go b/internal/server/event_handlers.go index d0b8e7162..a319c09d9 100644 --- a/internal/server/event_handlers.go +++ b/internal/server/event_handlers.go @@ -64,7 +64,7 @@ func (s *EventServer) handleEvent() func(w http.ResponseWriter, r *http.Request) cleanupMetadata(event) ctx, cancel := context.WithTimeout(r.Context(), 15*time.Second) - defer cancel() + defer cancel() var allAlerts v1beta1.AlertList err = s.kubeClient.List(ctx, &allAlerts) @@ -265,6 +265,8 @@ func (s *EventServer) handleEvent() func(w http.ResponseWriter, r *http.Request) } go func(n notifier.Interface, e events.Event) { + ctx, cancel := context.WithTimeout(r.Context(), 15*time.Second) + defer cancel() if err := n.Post(ctx, e); err != nil { maskedErrStr, maskErr := masktoken.MaskTokenFromString(err.Error(), token) if maskErr != nil {