From bb932af6d11c330815046b62c90ac4fb2ee242e7 Mon Sep 17 00:00:00 2001 From: Chandan Pasunoori Date: Fri, 22 Dec 2023 14:49:55 +0530 Subject: [PATCH] SIGTERM and SIGINT added for graceful shutdown --- cmd/root.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index 68e32b7..dcee89b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "os/signal" + "syscall" "time" "github.com/chandanpasunoori/event-sync/pkg" @@ -52,7 +53,7 @@ var rootCmd = &cobra.Command{ defer cancel() signalChan := make(chan os.Signal, 1) - signal.Notify(signalChan, os.Interrupt) + signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM, syscall.SIGINT) delay := 15 * time.Second go func() { <-signalChan