From 66017df0b9e2c562d7e72c63d18eb80883ec4484 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Tue, 26 Oct 2021 19:19:52 +0800 Subject: [PATCH] test msg --- src/msg_transfer/logic/history_msg_handler.go | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/msg_transfer/logic/history_msg_handler.go b/src/msg_transfer/logic/history_msg_handler.go index c547e449b..d3d992a64 100644 --- a/src/msg_transfer/logic/history_msg_handler.go +++ b/src/msg_transfer/logic/history_msg_handler.go @@ -63,20 +63,21 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string) log.Info("", "", "msg_transfer chat type = SingleChatType", isHistory, isPersist) if isHistory { if msgKey == pbSaveData.RecvID { - err := saveUserChat(pbData.RecvID, &pbSaveData) - if err != nil { - log.ErrorByKv("data insert to mongo err", pbSaveData.OperationID, "data", pbSaveData.String(), "err", err.Error()) - } + go func() { + err := saveUserChat(pbData.RecvID, &pbSaveData) + if err != nil { + log.ErrorByKv("data insert to mongo err", pbSaveData.OperationID, "data", pbSaveData.String(), "err", err.Error()) + } + }() + } else if msgKey == pbSaveData.SendID { - err := saveUserChat(pbData.SendID, &pbSaveData) - if err != nil { - log.ErrorByKv("data insert to mongo err", pbSaveData.OperationID, "data", pbSaveData.String(), "err", err.Error()) - } - //if isSenderSync { - // pbSaveData.ContentType = constant.SyncSenderMsg - // log.WarnByKv("SyncSenderMsg come here", pbData.OperationID, pbSaveData.String()) - // sendMessageToPush(&pbSaveData) - //} + go func() { + err := saveUserChat(pbData.SendID, &pbSaveData) + if err != nil { + log.ErrorByKv("data insert to mongo err", pbSaveData.OperationID, "data", pbSaveData.String(), "err", err.Error()) + } + }() + } log.NewInfo(pbSaveData.OperationID, "saveUserChat cost time ", utils.GetCurrentTimestampBySecond()-time)