fix: [2.5] Close client before remove worker client (#41254)

issue: #41252 

master pr: #41253

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
pull/41309/head
cai.zhang 2025-04-15 10:28:53 +08:00 committed by GitHub
parent afc0ca77e4
commit 04eae0b0f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -90,7 +90,12 @@ func (nm *IndexNodeManager) RemoveNode(nodeID typeutil.UniqueID) {
log.Ctx(nm.ctx).Debug("remove IndexNode", zap.Int64("nodeID", nodeID))
nm.lock.Lock()
defer nm.lock.Unlock()
delete(nm.nodeClients, nodeID)
if in, ok := nm.nodeClients[nodeID]; ok {
if err := in.Close(); err != nil {
log.Warn("Failed to close client connection", zap.Error(err))
}
delete(nm.nodeClients, nodeID)
}
delete(nm.stoppingNodes, nodeID)
metrics.IndexNodeNum.WithLabelValues().Set(float64(len(nm.nodeClients)))
}