enhance: Use channel name map finding channel watcher (#34294)

See also #33235

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-07-01 18:46:07 +08:00 committed by GitHub
parent 734415b8a2
commit e083d99dd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -384,20 +384,19 @@ func (m *ChannelManagerImplV2) FindWatcher(channel string) (UniqueID, error) {
infos := m.store.GetNodesChannels()
for _, info := range infos {
for _, channelInfo := range info.Channels {
if channelInfo.GetName() == channel {
_, ok := info.Channels[channel]
if ok {
return info.NodeID, nil
}
}
}
// channel in buffer
bufferInfo := m.store.GetBufferChannelInfo()
for _, channelInfo := range bufferInfo.Channels {
if channelInfo.GetName() == channel {
_, ok := bufferInfo.Channels[channel]
if ok {
return bufferID, errChannelInBuffer
}
}
return 0, errChannelNotWatched
}