Update README.md

This commit is contained in:
田欧 2019-02-20 13:09:24 +08:00 committed by GitHub
parent 983b0c2bed
commit 909ccd2ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1673,7 +1673,12 @@ func main() {
if err := srv.Shutdown(ctx); err != nil {
log.Fatal("Server Shutdown:", err)
}
log.Println("Server exiting")
// catching ctx.Done(). timeout of 5 seconds.
select {
case <-ctx.Done():
log.Println("timeout of 5 seconds.")
}
log.Println("Server exiting")
}
```