From 1afdd0bcf7c708b74a7ed84cb58f636deb007ed0 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Tue, 16 Jan 2024 11:15:28 +0800 Subject: [PATCH] feat: local cache --- internal/rpc/msg/send.go | 1 + internal/rpc/msg/verify.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/rpc/msg/send.go b/internal/rpc/msg/send.go index 630b74a4a..b1052b192 100644 --- a/internal/rpc/msg/send.go +++ b/internal/rpc/msg/send.go @@ -144,6 +144,7 @@ func (m *msgServer) sendMsgNotification( } func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq) (resp *pbmsg.SendMsgResp, err error) { + log.ZDebug(ctx, "sendMsgSingleChat return") if err := m.messageVerification(ctx, req); err != nil { return nil, err } diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index 9f6ca727a..792b9c3d6 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -16,6 +16,7 @@ package msg import ( "context" + "github.com/OpenIMSDK/tools/log" "math/rand" "strconv" "time" @@ -186,7 +187,8 @@ func (m *msgServer) modifyMessageByUserMessageReceiveOpt( sessionType int, pb *msg.SendMsgReq, ) (bool, error) { - opt, err := m.User.GetUserGlobalMsgRecvOpt(ctx, userID) + defer log.ZDebug(ctx, "modifyMessageByUserMessageReceiveOpt return") + opt, err := m.User.GetUserGlobalMsgRecvOpt(ctx, userID) // todo local cache if err != nil { return false, err } @@ -202,7 +204,7 @@ func (m *msgServer) modifyMessageByUserMessageReceiveOpt( return true, nil } // conversationID := utils.GetConversationIDBySessionType(conversationID, sessionType) - singleOpt, err := m.Conversation.GetSingleConversationRecvMsgOpt(ctx, userID, conversationID) + singleOpt, err := m.Conversation.GetSingleConversationRecvMsgOpt(ctx, userID, conversationID) // todo local cache if errs.ErrRecordNotFound.Is(err) { return true, nil } else if err != nil {