feat(storage): update storage

This commit is contained in:
bandl 2021-10-16 22:51:51 +08:00
parent 40374333fa
commit 52c9b166f3
1 changed files with 4 additions and 20 deletions

View File

@ -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)
}
},
}