Skip to content

Commit 623577e

Browse files
authored
Update server.go
Add hint on using buffered channel for signal.Notify
1 parent c96e2e1 commit 623577e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cookbook/graceful-shutdown/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ func main() {
2727
}
2828
}()
2929

30-
// Wait for interrupt signal to gracefully shutdown the server with
31-
// a timeout of 10 seconds.
30+
// Wait for interrupt signal to gracefully shutdown the server with a timeout of 10 seconds.
31+
// Use a buffered channel to avoid missing signals as recommended for signal.Notify
3232
quit := make(chan os.Signal, 1)
3333
signal.Notify(quit, os.Interrupt)
3434
<-quit

0 commit comments

Comments
 (0)