msg bug fix

This commit is contained in:
Gordon 2022-05-13 16:19:11 +08:00
parent 20c7fe81dc
commit a472da9ea6

View File

@ -256,7 +256,6 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
} }
onUserIDList, offUserIDList := getOnlineAndOfflineUserIDList(memberUserIDList, pb.OperationID) onUserIDList, offUserIDList := getOnlineAndOfflineUserIDList(memberUserIDList, pb.OperationID)
log.Debug(pb.OperationID, onUserIDList, offUserIDList) log.Debug(pb.OperationID, onUserIDList, offUserIDList)
groupID := pb.MsgData.GroupID
//split parallel send //split parallel send
var wg sync.WaitGroup var wg sync.WaitGroup
var sendTag bool var sendTag bool
@ -281,21 +280,8 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
go rpc.sendMsgToGroup(offUserIDList[split*(len(offUserIDList)/split):], *pb, constant.OfflineStatus, &sendTag, &wg) go rpc.sendMsgToGroup(offUserIDList[split*(len(offUserIDList)/split):], *pb, constant.OfflineStatus, &sendTag, &wg)
} }
wg.Wait() wg.Wait()
log.Info(msgToMQSingle.OperationID, "addUidList", addUidList) wg.Add(1)
for _, v := range addUidList { rpc.sendMsgToGroup(addUidList, *pb, constant.OnlineStatus, &sendTag, &wg)
pb.MsgData.RecvID = v
isSend := modifyMessageByUserMessageReceiveOpt(v, groupID, constant.GroupChatType, pb)
log.Info(msgToMQSingle.OperationID, "isSend", isSend)
if isSend {
msgToMQSingle.MsgData = pb.MsgData
err := rpc.sendMsgToKafka(&msgToMQSingle, v, constant.OnlineStatus)
if err != nil {
log.NewError(msgToMQSingle.OperationID, "kafka send msg err:UserId", v, msgToMQSingle.String())
} else {
sendTag = true
}
}
}
// callback // callback
if err := callbackAfterSendGroupMsg(pb); err != nil { if err := callbackAfterSendGroupMsg(pb); err != nil {
log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendGroupMsg failed", err.Error()) log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendGroupMsg failed", err.Error())