Skip to content

Commit

Permalink
SIGTERM and SIGINT added for graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
chandanpasunoori committed Dec 22, 2023
1 parent 75ced96 commit bb932af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"os"
"os/signal"
"syscall"
"time"

"github.com/chandanpasunoori/event-sync/pkg"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bb932af

Please sign in to comment.