消息能力升级 #1

Merged
zhangdeman merged 17 commits from feature/upgrade into master 2024-07-17 15:45:22 +08:00
Showing only changes of commit 7fe6003db8 - Show all commits

View File

@ -152,10 +152,11 @@ func (r *RedisEventPubSub) ConsumeEvent(handler abstract.EventHandler, successCa
if nil == successCallback {
successCallback = define.DefaultSuccessCallbackHandler
}
go func() {
for partition := 0; partition < r.pubSubConfig.PartitionNum; partition++ {
go func(realPartition int) {
defer func() {
if panicErr := recover(); nil != panicErr {
fmt.Println(r)
r.panicCallback(panicErr, nil, nil)
}
}()
for !r.isStop || (r.isStop && len(messageChan) == 0) {
@ -165,14 +166,14 @@ func (r *RedisEventPubSub) ConsumeEvent(handler abstract.EventHandler, successCa
if nil != handlerErr {
// 失败回调
failureCallback(eventData, handlerResult, handlerErr)
break
} else {
// 成功回调
successCallback(eventData, handlerResult)
}
}
}
}()
}(partition)
}
return nil
}