[ Cmii ] [ Octopus ] - hot fix manual shut down init queue

This commit is contained in:
zeaslity
2024-04-09 10:10:51 +08:00
parent af98a0dcfc
commit bcb46ec8aa
4 changed files with 18 additions and 6 deletions

View File

@@ -46,6 +46,8 @@ type RabbitQueue struct {
RabbitConnectInfo *RabbitTCPConnectInfo
// 返回消息队列
ReceiveChan *RabbitReceiveChan
// Consume 是否继续
ConsumeOK bool
}
// RabbitMQConn is a struct that holds the connection and channel objects
@@ -192,6 +194,7 @@ func (r *RabbitQueue) Close() error {
func (r *RabbitQueue) Handle() chan bool {
deliveries := r.Read(true)
foreverHandle := make(chan bool)
// 死循环处理Octopus Message
P.Submit(func() {
@@ -208,6 +211,13 @@ func (r *RabbitQueue) Handle() chan bool {
P.Submit(func() {
om.HandleMsg(r.ReceiveChan)
})
// 2024年4月9日
if !r.ConsumeOK {
marshal, _ := json.Marshal(r.RabbitProp)
log.InfoF("Rabbit Queue of %s disconnect!", marshal)
break
}
}
})
return foreverHandle