milvus/cmd/querynode/querynode.go
XuanYang-cn 90d471b133 Refactor main of queryservice and querynode
Signed-off-by: XuanYang-cn <xuan.yang@zilliz.com>
2021-02-02 09:52:42 +08:00

41 lines
615 B
Go

package main
import (
"context"
"log"
"os"
"os/signal"
"syscall"
distributed "github.com/zilliztech/milvus-distributed/cmd/distributed/components"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
svr, err := distributed.NewQueryNode(ctx)
if err != nil {
panic(err)
}
if err = svr.Run(); err != nil {
panic(err)
}
sc := make(chan os.Signal, 1)
signal.Notify(sc,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGQUIT)
sig := <-sc
log.Print("Got signal to exit", sig.String())
if err := svr.Stop(); err != nil {
panic(err)
}
}