This commit is contained in:
wangchuxiao 2022-09-13 18:31:47 +08:00
parent 9a5c0bae50
commit d491c482a5

View File

@ -433,6 +433,13 @@ func DelJoinedSuperGroupIDListFromCache(userID string) error {
func GetGroupMemberListHashFromCache(groupID string) (uint64, error) {
generateHash := func() (string, error) {
groupInfo, err := GetGroupInfoFromCache(groupID)
if err != nil {
return "0", utils.Wrap(err, "GetGroupInfoFromCache failed")
}
if groupInfo.Status == constant.GroupStatusDismissed {
return "0", nil
}
groupMemberIDList, err := GetGroupMemberIDListFromCache(groupID)
if err != nil {
return "", utils.Wrap(err, "GetGroupMemberIDListFromCache failed")
@ -447,6 +454,9 @@ func GetGroupMemberListHashFromCache(groupID string) (uint64, error) {
return strconv.Itoa(int(bi.Uint64())), nil
}
hashCode, err := db.DB.Rc.Fetch(groupMemberListHashCache+groupID, time.Second*30*60, generateHash)
if err != nil {
return 0, utils.Wrap(err, "fetch failed")
}
hashCodeUint64, err := strconv.Atoi(hashCode)
return uint64(hashCodeUint64), err
}