This is an automated email from the ASF dual-hosted git repository. joezou pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
commit 7896b90c03c6ddc06a4c95884f2cc45a1b02620b Author: Joe Zou <yixian....@gmail.com> AuthorDate: Wed Oct 21 23:26:59 2020 +0800 test it in metric/dubbo --- metric/dubbo/go-client/app/client.go | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/metric/dubbo/go-client/app/client.go b/metric/dubbo/go-client/app/client.go index 501cd8b..f4f9ff3 100644 --- a/metric/dubbo/go-client/app/client.go +++ b/metric/dubbo/go-client/app/client.go @@ -19,11 +19,7 @@ package main import ( "context" - "fmt" "os" - "os/signal" - "syscall" - "time" ) import ( @@ -32,7 +28,6 @@ import ( import ( hessian "github.com/apache/dubbo-go-hessian2" - "github.com/apache/dubbo-go/common/logger" _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" "github.com/apache/dubbo-go/config" _ "github.com/apache/dubbo-go/protocol/dubbo" @@ -60,32 +55,9 @@ func main() { user := &User{} err := userProvider.GetUser(context.Background(), []interface{}{"A001"}, user) if err != nil { - panic(err) + gxlog.CError("error: %v\n", err) + os.Exit(1) + return } gxlog.CInfo("response result: %v\n", user) - initSignal() -} - -func initSignal() { - signals := make(chan os.Signal, 1) - // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, - syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) - for { - sig := <-signals - logger.Infof("get signal %s", sig.String()) - switch sig { - case syscall.SIGHUP: - // reload() - default: - time.AfterFunc(time.Duration(survivalTimeout), func() { - logger.Warnf("app exit now by force...") - os.Exit(1) - }) - - // The program exits normally or timeout forcibly exits. - fmt.Println("app exit now...") - return - } - } } \ No newline at end of file