From 40a1d275c9a2edc533e33e98e4fc5a7451925dde Mon Sep 17 00:00:00 2001 From: rickwang7712 Date: Fri, 8 Jul 2022 15:20:52 +0800 Subject: [PATCH] fix: graceful shutdown should use buffered signal The channel used with signal.Notify should be buffered. ref: https://pkg.go.dev/os/signal#Notify --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2477d0b0..6b9d3552 100644 --- a/README.md +++ b/README.md @@ -1841,7 +1841,7 @@ func main() { // Wait for interrupt signal to gracefully shutdown the server with // a timeout of 5 seconds. - quit := make(chan os.Signal) + quit := make(chan os.Signal, 1) // kill (no param) default send syscall.SIGTERM // kill -2 is syscall.SIGINT // kill -9 is syscall.SIGKILL but can't be caught, so don't need to add it