mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
f4c643f1bd
Signed-off-by: sunby <bingyi.sun@zilliz.com>
44 lines
569 B
Go
44 lines
569 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/querynode"
|
|
)
|
|
|
|
func main() {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
defer cancel()
|
|
|
|
querynode.Init()
|
|
|
|
sc := make(chan os.Signal, 1)
|
|
signal.Notify(sc,
|
|
syscall.SIGHUP,
|
|
syscall.SIGINT,
|
|
syscall.SIGTERM,
|
|
syscall.SIGQUIT)
|
|
|
|
var sig os.Signal
|
|
go func() {
|
|
sig = <-sc
|
|
cancel()
|
|
}()
|
|
|
|
querynode.StartQueryNode(ctx)
|
|
|
|
switch sig {
|
|
case syscall.SIGTERM:
|
|
exit(0)
|
|
default:
|
|
exit(1)
|
|
}
|
|
}
|
|
|
|
func exit(code int) {
|
|
os.Exit(code)
|
|
}
|