From ee2c60a373265195ec1dac688147304bce126abf Mon Sep 17 00:00:00 2001 From: Jeeyong Um Date: Fri, 20 Aug 2021 10:58:34 +0900 Subject: [PATCH] Revert "docs: fix graceful shutdown in go built-in example" This reverts commit cbf5511b028e701cd058b1c26ed8046758462b65. --- docs/tutorials/go-built-in.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/tutorials/go-built-in.md b/docs/tutorials/go-built-in.md index 6f5c46830..81325706b 100644 --- a/docs/tutorials/go-built-in.md +++ b/docs/tutorials/go-built-in.md @@ -380,13 +380,14 @@ func main() { } node.Start() + defer func() { + node.Stop() + node.Wait() + }() c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) <-c - - node.Stop() - node.Wait() os.Exit(0) } @@ -555,13 +556,14 @@ upon receiving SIGTERM or Ctrl-C. ```go node.Start() +defer func() { + node.Stop() + node.Wait() +}() c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) <-c - -node.Stop() -node.Wait() os.Exit(0) ```