From e12207fc73e1731f2b5590c5fd9552727a4a5735 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Fri, 20 May 2022 15:40:40 +0800 Subject: [PATCH] concurrent consumption of messages --- internal/msg_transfer/logic/online_history_msg_handler.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/msg_transfer/logic/online_history_msg_handler.go b/internal/msg_transfer/logic/online_history_msg_handler.go index b33014bc4..622f7eae6 100644 --- a/internal/msg_transfer/logic/online_history_msg_handler.go +++ b/internal/msg_transfer/logic/online_history_msg_handler.go @@ -239,7 +239,9 @@ func (och *OnlineHistoryConsumerHandler) MessagesDistributionHandle() { log.Debug(triggerID, "generate map list users len", len(UserAggregationMsgs)) for userID, v := range UserAggregationMsgs { if len(v) >= 0 { - channelID := getHashCode(userID) % ChannelNum + hashCode := getHashCode(userID) + channelID := hashCode % ChannelNum + log.Debug(triggerID, "generate channelID", hashCode, channelID, userID) go func(cID uint32, userID string, messages []*pbMsg.MsgDataToMQ) { och.chArrays[cID] <- Cmd2Value{Cmd: UserMessages, Value: MsgChannelValue{userID: userID, msgList: messages, triggerID: triggerID}} }(channelID, userID, v)