mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 01:57:55 +08:00
Update server.go
This commit is contained in:
parent
d3c6fecb57
commit
71ef1798c6
@ -1,4 +1,4 @@
|
|||||||
// +build go1.8
|
// +build go1.11
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@ -44,9 +44,10 @@ 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.
|
// catching ctx.Done(). timeout of 5 seconds.
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
log.Println("timeout of 5 seconds.")
|
||||||
}
|
}
|
||||||
log.Println("Server exiting")
|
log.Println("Server exiting")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user