From b92c74914a5bfd7a3e30627f76db7be98be72f49 Mon Sep 17 00:00:00 2001 From: luncrzs Date: Sat, 14 Dec 2024 14:07:38 +0800 Subject: [PATCH] Fix graceful restart or stop example code --- content/en/docs/examples/graceful-restart-or-stop.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/en/docs/examples/graceful-restart-or-stop.md b/content/en/docs/examples/graceful-restart-or-stop.md index aae74ebd8..6f6ff3dc8 100644 --- a/content/en/docs/examples/graceful-restart-or-stop.md +++ b/content/en/docs/examples/graceful-restart-or-stop.md @@ -72,12 +72,14 @@ func main() { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() if err := srv.Shutdown(ctx); err != nil { - log.Fatal("Server Shutdown:", err) + log.Println("Server Shutdown:", err) } // catching ctx.Done(). timeout of 5 seconds. select { case <-ctx.Done(): log.Println("timeout of 5 seconds.") + default: + break } log.Println("Server exiting") }