error occurs when an empty slice operated by sadd

pull/218/head
Jason 3 years ago
parent b696984655
commit 2ac869de50

@ -143,6 +143,10 @@ func updateAllFriendToCache(userList []db.User) error {
log.NewError("0", utils.GetSelfFuncName(), err.Error())
continue
}
if len(friendIDList) == 0 {
log.NewWarn("0", utils.GetSelfFuncName(), "friendIDList is empty")
continue
}
if err := db.DB.AddFriendToCache(user.UserID, friendIDList...); err != nil {
log.NewError("0", utils.GetSelfFuncName(), err.Error())
}
@ -159,6 +163,10 @@ func updateAllBlackListToCache(userList []db.User) error {
log.NewError("", utils.GetSelfFuncName(), err.Error())
continue
}
if len(blackIDList) == 0 {
log.NewWarn("0", utils.GetSelfFuncName(), "blackIDList is empty")
continue
}
if err := db.DB.AddBlackUserToCache(user.UserID, blackIDList...); err != nil {
log.NewError("0", utils.GetSelfFuncName(), err.Error())
}

Loading…
Cancel
Save