mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
32445dd02b
Signed-off-by: neza2017 <yefu.chen@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)
|
|
}
|