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

Loading…
Cancel
Save