Proxy exit when disconnected to etcd (#13180)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/13213/head
dragondriver 2021-12-10 22:09:17 +08:00 committed by GitHub
parent 3f0970153c
commit 175f3147d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import (
"math/rand" "math/rand"
"sync" "sync"
"sync/atomic" "sync/atomic"
"syscall"
"time" "time"
"github.com/milvus-io/milvus/internal/util/metricsinfo" "github.com/milvus-io/milvus/internal/util/metricsinfo"
@ -118,6 +119,7 @@ func (node *Proxy) Register() error {
if err := node.Stop(); err != nil { if err := node.Stop(); err != nil {
log.Fatal("failed to stop server", zap.Error(err)) log.Fatal("failed to stop server", zap.Error(err))
} }
syscall.Kill(syscall.Getpid(), syscall.SIGINT)
}) })
// TODO Reset the logger // TODO Reset the logger
//Params.initLogCfg() //Params.initLogCfg()
@ -347,18 +349,25 @@ func (node *Proxy) Stop() error {
if node.idAllocator != nil { if node.idAllocator != nil {
node.idAllocator.Close() node.idAllocator.Close()
log.Info("close id allocator", zap.String("role", Params.RoleName))
} }
if node.segAssigner != nil { if node.segAssigner != nil {
node.segAssigner.Close() node.segAssigner.Close()
log.Info("close segment id assigner", zap.String("role", Params.RoleName))
} }
if node.sched != nil { if node.sched != nil {
node.sched.Close() node.sched.Close()
log.Info("close scheduler", zap.String("role", Params.RoleName))
} }
if node.chTicker != nil { if node.chTicker != nil {
err := node.chTicker.close() err := node.chTicker.close()
if err != nil { if err != nil {
return err return err
} }
log.Info("close channels time ticker", zap.String("role", Params.RoleName))
} }
node.wg.Wait() node.wg.Wait()