mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 20:30:40 +08:00
send message
This commit is contained in:
parent
aa57f25b2c
commit
6d5b38fc8a
@ -45,32 +45,20 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
|
|||||||
isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory)
|
isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory)
|
||||||
//Control whether to store history messages (mysql)
|
//Control whether to store history messages (mysql)
|
||||||
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
|
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
|
||||||
isSenderSync := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsSenderSync)
|
//isSenderSync := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsSenderSync)
|
||||||
switch msgFromMQ.MsgData.SessionType {
|
switch msgFromMQ.MsgData.SessionType {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = SingleChatType", isHistory, isPersist)
|
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = SingleChatType", isHistory, isPersist)
|
||||||
if isHistory {
|
if isHistory {
|
||||||
if msgKey == msgFromMQ.MsgData.RecvID {
|
err := saveUserChat(msgKey, &msgFromMQ)
|
||||||
err := saveUserChat(msgFromMQ.MsgData.RecvID, &msgFromMQ)
|
if err != nil {
|
||||||
if err != nil {
|
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String())
|
||||||
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String())
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
go sendMessageToPush(&msgFromMQ, msgFromMQ.MsgData.RecvID)
|
|
||||||
log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time)
|
|
||||||
|
|
||||||
} else if msgKey == msgFromMQ.MsgData.SendID {
|
|
||||||
err := saveUserChat(msgFromMQ.MsgData.SendID, &msgFromMQ)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if isSenderSync {
|
|
||||||
go sendMessageToPush(&msgFromMQ, msgFromMQ.MsgData.SendID)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.NewDebug(operationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time)
|
log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time)
|
||||||
}
|
}
|
||||||
|
go sendMessageToPush(&msgFromMQ, msgKey)
|
||||||
|
log.NewDebug(operationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time)
|
||||||
case constant.GroupChatType:
|
case constant.GroupChatType:
|
||||||
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = GroupChatType", isHistory, isPersist)
|
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = GroupChatType", isHistory, isPersist)
|
||||||
if isHistory {
|
if isHistory {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user