Update server.go

It's necessary that  catching  ctx.Done()
This commit is contained in:
ffhelicopter 2018-09-04 23:59:48 +08:00 committed by GitHub
parent 500ebd9ea8
commit d3c6fecb57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")
} }