Skip to content

Commit 72fa2f1

Browse files
committed
Tell Go runtime we have stopped listening to signals
If we exit the handler loop, e.g. after receiving SIGTERM, then we don't want Go to attempt further delivery of signals.
1 parent 02b9c3f commit 72fa2f1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

signals/signals.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func (h *Handler) Stop() {
4242
func (h *Handler) Loop() {
4343
sigs := make(chan os.Signal, 1)
4444
signal.Notify(sigs, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM)
45+
defer signal.Stop(sigs)
4546
buf := make([]byte, 1<<20)
4647
for {
4748
select {

0 commit comments

Comments
 (0)