From 52c9b166f3c5689870bbfaed96dd2b2258e2361f Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sat, 16 Oct 2021 22:51:51 +0800 Subject: [PATCH] feat(storage): update storage --- storage/cmd/root.go | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/storage/cmd/root.go b/storage/cmd/root.go index b4c00f4..22424a4 100644 --- a/storage/cmd/root.go +++ b/storage/cmd/root.go @@ -5,15 +5,13 @@ import ( "fmt" "log" "net" - "os" - "os/signal" - "syscall" "gitee.com/timedb/wheatCache/storage/server/single" _ "gitee.com/timedb/wheatCache/conf" "gitee.com/timedb/wheatCache/pkg/logx" "gitee.com/timedb/wheatCache/pkg/proto" + "gitee.com/timedb/wheatCache/pkg/util/server" "github.com/spf13/cobra" "github.com/spf13/viper" "google.golang.org/grpc" @@ -44,25 +42,11 @@ var rootCmd = &cobra.Command{ proto.RegisterCommServerServer(s, storageServer) reflection.Register(s) - c := make(chan os.Signal) - signal.Notify(c, syscall.SIGHUP, syscall.SIGINT) - go func() { - select { - case <-c: - s.Stop() - - msg := ` - |-------Wheat tools---------| - | see you next time | - |thank you for your efforts | - |---------------------------| - ` - fmt.Println(msg) - } - }() + server.ElegantExitServer(s) + logx.Info("start gateway in addr: %s", tcpAddr.String()) if err := s.Serve(listen); err != nil { - log.Panicln(err) + logx.Errorln(err) } }, }