cache bug fix

pull/232/head
wangchuxiao 3 years ago
parent 4a631753a0
commit 62dd559b7c

@ -11,10 +11,11 @@ import (
commonPb "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"context"
"google.golang.org/grpc"
"net"
"strconv"
"strings"
"google.golang.org/grpc"
)
type cacheServer struct {
@ -127,8 +128,12 @@ func updateAllGroupMemberListToCache() error {
continue
}
log.NewDebug("", utils.GetSelfFuncName(), "groupMemberIDList", groupMemberIDList)
if err := db.DB.AddGroupMemberToCache(groupID, groupMemberIDList...); err != nil {
log.NewError("", utils.GetSelfFuncName(), "AddGroupMemberToCache", err.Error())
if len(groupMemberIDList) > 0 {
if err := db.DB.AddGroupMemberToCache(groupID, groupMemberIDList...); err != nil {
log.NewError("", utils.GetSelfFuncName(), "AddGroupMemberToCache", err.Error())
}
} else {
log.NewInfo("0", groupID, groupMemberIDList)
}
}
log.NewInfo("0", utils.GetSelfFuncName(), "ok")
@ -143,9 +148,14 @@ func updateAllFriendToCache(userList []db.User) error {
log.NewError("0", utils.GetSelfFuncName(), err.Error())
continue
}
if err := db.DB.AddFriendToCache(user.UserID, friendIDList...); err != nil {
log.NewError("0", utils.GetSelfFuncName(), err.Error())
if len(friendIDList) > 0 {
if err := db.DB.AddFriendToCache(user.UserID, friendIDList...); err != nil {
log.NewError("0", utils.GetSelfFuncName(), err.Error(), friendIDList, user.UserID)
}
} else {
log.NewInfo("0", user.UserID, friendIDList)
}
}
log.NewInfo("0", utils.GetSelfFuncName(), "ok")
return nil
@ -159,8 +169,12 @@ func updateAllBlackListToCache(userList []db.User) error {
log.NewError("", utils.GetSelfFuncName(), err.Error())
continue
}
if err := db.DB.AddBlackUserToCache(user.UserID, blackIDList...); err != nil {
log.NewError("0", utils.GetSelfFuncName(), err.Error())
if len(blackIDList) > 0 {
if err := db.DB.AddBlackUserToCache(user.UserID, blackIDList...); err != nil {
log.NewError("0", utils.GetSelfFuncName(), err.Error())
}
} else {
log.NewInfo("0", utils.GetSelfFuncName(), user.UserID, blackIDList)
}
}
log.NewInfo("0", utils.GetSelfFuncName(), "ok")

Loading…
Cancel
Save