mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 21:32:11 +08:00
fix: graceful shutdown should use buffered signal
The channel used with signal.Notify should be buffered. ref: https://pkg.go.dev/os/signal#Notify
This commit is contained in:
parent
b57163a0e4
commit
40a1d275c9
@ -1841,7 +1841,7 @@ func main() {
|
|||||||
|
|
||||||
// Wait for interrupt signal to gracefully shutdown the server with
|
// Wait for interrupt signal to gracefully shutdown the server with
|
||||||
// a timeout of 5 seconds.
|
// a timeout of 5 seconds.
|
||||||
quit := make(chan os.Signal)
|
quit := make(chan os.Signal, 1)
|
||||||
// kill (no param) default send syscall.SIGTERM
|
// kill (no param) default send syscall.SIGTERM
|
||||||
// kill -2 is syscall.SIGINT
|
// kill -2 is syscall.SIGINT
|
||||||
// kill -9 is syscall.SIGKILL but can't be caught, so don't need to add it
|
// kill -9 is syscall.SIGKILL but can't be caught, so don't need to add it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user