mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 01:57:55 +08:00
Update server.go
It's necessary that catching ctx.Done()
This commit is contained in:
parent
500ebd9ea8
commit
d3c6fecb57
@ -44,5 +44,9 @@ func main() {
|
|||||||
if err := srv.Shutdown(ctx); err != nil {
|
if err := srv.Shutdown(ctx); err != nil {
|
||||||
log.Fatal("Server Shutdown:", err)
|
log.Fatal("Server Shutdown:", err)
|
||||||
}
|
}
|
||||||
|
// catching ctx.Done(). timeout of 5 seconds.
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
}
|
||||||
log.Println("Server exiting")
|
log.Println("Server exiting")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user