mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Start once for IndexNode (#8170)
Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
82c28d225c
commit
93c912e681
@ -62,6 +62,8 @@ type IndexNode struct {
|
||||
|
||||
sched *TaskScheduler
|
||||
|
||||
once sync.Once
|
||||
|
||||
kv kv.BaseKV
|
||||
session *sessionutil.Session
|
||||
liveCh <-chan bool
|
||||
@ -161,20 +163,25 @@ func (i *IndexNode) Init() error {
|
||||
}
|
||||
|
||||
func (i *IndexNode) Start() error {
|
||||
i.sched.Start()
|
||||
var startErr error = nil
|
||||
i.once.Do(func() {
|
||||
startErr = i.sched.Start()
|
||||
|
||||
//start liveness check
|
||||
go i.session.LivenessCheck(i.loopCtx, i.liveCh, func() {
|
||||
i.Stop()
|
||||
//start liveness check
|
||||
go i.session.LivenessCheck(i.loopCtx, i.liveCh, func() {
|
||||
i.Stop()
|
||||
})
|
||||
|
||||
i.UpdateStateCode(internalpb.StateCode_Healthy)
|
||||
log.Debug("IndexNode", zap.Any("State", i.stateCode.Load()))
|
||||
})
|
||||
|
||||
i.UpdateStateCode(internalpb.StateCode_Healthy)
|
||||
log.Debug("IndexNode", zap.Any("State", i.stateCode.Load()))
|
||||
// Start callbacks
|
||||
for _, cb := range i.startCallbacks {
|
||||
cb()
|
||||
}
|
||||
return nil
|
||||
|
||||
log.Debug("IndexNode start finished", zap.Error(startErr))
|
||||
return startErr
|
||||
}
|
||||
|
||||
// Stop Close closes the server.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user