From 9eb18701962ebaf7033a7bbaa8d9783ee4249325 Mon Sep 17 00:00:00 2001
From: wangchuxiao <wangchuxiao97@outlook.com>
Date: Wed, 25 May 2022 16:01:34 +0800
Subject: [PATCH] Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server
 into tuoyun

# Conflicts:
#	internal/rpc/msg/rpcChat.go
---
 internal/rpc/msg/rpcChat.go | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/internal/rpc/msg/rpcChat.go b/internal/rpc/msg/rpcChat.go
index 59b36f65d..e42f4f465 100644
--- a/internal/rpc/msg/rpcChat.go
+++ b/internal/rpc/msg/rpcChat.go
@@ -91,11 +91,15 @@ func (rpc *rpcChat) runCh() {
 	for {
 		select {
 		case msg := <-rpc.delMsgCh:
-			if unexistSeqList, err := db.DB.DelMsgBySeqList(msg.UserID, msg.SeqList, msg.OperationID); err != nil {
+			db.DB.DelMsgFromCache(msg.UserID, msg.SeqList, msg.OperationID)
+			unexistSeqList, err := db.DB.DelMsgBySeqList(msg.UserID, msg.SeqList, msg.OperationID)
+			if err != nil {
 				log.NewError(msg.OperationID, utils.GetSelfFuncName(), "DelMsgBySeqList args: ", msg.UserID, msg.SeqList, msg.OperationID, err.Error())
-				DeleteMessageNotification(msg.OpUserID, msg.UserID, unexistSeqList, msg.OperationID)
+				continue
+			}
+			if len(unexistSeqList) > 0 {
+				DeleteMessageNotification(msg.OpUserID, msg.UserID, msg.SeqList, msg.OperationID)
 			}
-			db.DB.DelMsgFromCache(msg.UserID, msg.SeqList, msg.OperationID)
 		}
 	}
 }