From d869b7c004cc9d710cfc0d69bbb36edf477c121c Mon Sep 17 00:00:00 2001 From: goshado Date: Thu, 9 Jan 2025 21:25:27 +0200 Subject: [PATCH] fix: event handler listen to ctx.Done --- cmd/piper/piper.go | 2 +- pkg/event_handler/main.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/piper/piper.go b/cmd/piper/piper.go index 30412a0..d9f378e 100644 --- a/cmd/piper/piper.go +++ b/cmd/piper/piper.go @@ -51,6 +51,6 @@ func main() { // Create context that listens for the interrupt signal from the OS. ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer stop() - event_handler.Start(ctx, stop, cfg, globalClients) + event_handler.Start(ctx, cfg, globalClients) server.Start(ctx, stop, cfg, globalClients) } diff --git a/pkg/event_handler/main.go b/pkg/event_handler/main.go index b620b0b..374604d 100644 --- a/pkg/event_handler/main.go +++ b/pkg/event_handler/main.go @@ -8,7 +8,7 @@ import ( "log" ) -func Start(ctx context.Context, stop context.CancelFunc, cfg *conf.GlobalConfig, clients *clients.Clients) { +func Start(ctx context.Context, cfg *conf.GlobalConfig, clients *clients.Clients) { labelSelector := &metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ {Key: "piper.quickube.com/notified", @@ -43,7 +43,6 @@ func Start(ctx context.Context, stop context.CancelFunc, cfg *conf.GlobalConfig, log.Printf("[event handler] failed to Handle workflow event: %v", err2) } } - stop() } }()