Browse Source

stop rpc server when main function exit (#120)

add defer s.Stop() to mainTemplate, in order to stop rpc server when main function exit
super_mario 4 năm trước cách đây
mục cha
commit
84cc41df42
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      tools/goctl/rpc/gen/genmain.go

+ 1 - 0
tools/goctl/rpc/gen/genmain.go

@@ -39,6 +39,7 @@ func main() {
 		{{.registers}}
 	})
 	logx.Must(err)
+	defer s.Stop()
 
 	fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
 	s.Start()