feat(storage): update storage
This commit is contained in:
parent
40374333fa
commit
52c9b166f3
|
@ -5,15 +5,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"gitee.com/timedb/wheatCache/storage/server/single"
|
"gitee.com/timedb/wheatCache/storage/server/single"
|
||||||
|
|
||||||
_ "gitee.com/timedb/wheatCache/conf"
|
_ "gitee.com/timedb/wheatCache/conf"
|
||||||
"gitee.com/timedb/wheatCache/pkg/logx"
|
"gitee.com/timedb/wheatCache/pkg/logx"
|
||||||
"gitee.com/timedb/wheatCache/pkg/proto"
|
"gitee.com/timedb/wheatCache/pkg/proto"
|
||||||
|
"gitee.com/timedb/wheatCache/pkg/util/server"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
@ -44,25 +42,11 @@ var rootCmd = &cobra.Command{
|
||||||
proto.RegisterCommServerServer(s, storageServer)
|
proto.RegisterCommServerServer(s, storageServer)
|
||||||
reflection.Register(s)
|
reflection.Register(s)
|
||||||
|
|
||||||
c := make(chan os.Signal)
|
server.ElegantExitServer(s)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
|
logx.Info("start gateway in addr: %s", tcpAddr.String())
|
||||||
if err := s.Serve(listen); err != nil {
|
if err := s.Serve(listen); err != nil {
|
||||||
log.Panicln(err)
|
logx.Errorln(err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue