未验证 提交 3a222e97 编写于 作者: W wei liu 提交者: GitHub

fix consumer close may block forever (#25120)

Signed-off-by: NWei Liu <wei.liu@zilliz.com>
上级 68ae199a
......@@ -149,7 +149,11 @@ func (kc *Consumer) Chan() <-chan mqwrapper.Message {
kc.skipMsg = false
continue
}
kc.msgChannel <- &kafkaMessage{msg: e}
select {
case kc.msgChannel <- &kafkaMessage{msg: e}:
case <-kc.closeCh:
}
}
}
}
......
......@@ -76,8 +76,12 @@ func (pc *Consumer) Chan() <-chan mqwrapper.Message {
log.Debug("pulsar consumer channel closed")
return
}
if !pc.skip {
pc.msgChannel <- &pulsarMessage{msg: msg}
select {
case pc.msgChannel <- &pulsarMessage{msg: msg}:
case <-pc.closeCh:
}
} else {
pc.skip = false
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册