Skip to content

Commit

Permalink
Set up signal handler sooner to that sigint right after start does no…
Browse files Browse the repository at this point in the history
…t crash daemon
  • Loading branch information
gammazero committed Jun 27, 2024
1 parent 7a3df67 commit b530b26
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,13 @@ share the same seed as long as the indexes are different.
}

quit := make(chan os.Signal, 3)
signal.Notify(
quit,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGHUP,
)

var wg sync.WaitGroup
wg.Add(2)

Expand Down Expand Up @@ -575,12 +582,6 @@ share the same seed as long as the indexes are different.
}

sddaemon.SdNotify(false, sddaemon.SdNotifyReady)
signal.Notify(
quit,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGHUP,
)
<-quit
sddaemon.SdNotify(false, sddaemon.SdNotifyStopping)
goLog.Info("Closing servers...")
Expand Down

0 comments on commit b530b26

Please sign in to comment.