mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-04 01:01:09 +08:00
hash
This commit is contained in:
parent
9a5c0bae50
commit
d491c482a5
@ -433,6 +433,13 @@ func DelJoinedSuperGroupIDListFromCache(userID string) error {
|
|||||||
|
|
||||||
func GetGroupMemberListHashFromCache(groupID string) (uint64, error) {
|
func GetGroupMemberListHashFromCache(groupID string) (uint64, error) {
|
||||||
generateHash := func() (string, 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)
|
groupMemberIDList, err := GetGroupMemberIDListFromCache(groupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", utils.Wrap(err, "GetGroupMemberIDListFromCache failed")
|
return "", utils.Wrap(err, "GetGroupMemberIDListFromCache failed")
|
||||||
@ -447,6 +454,9 @@ func GetGroupMemberListHashFromCache(groupID string) (uint64, error) {
|
|||||||
return strconv.Itoa(int(bi.Uint64())), nil
|
return strconv.Itoa(int(bi.Uint64())), nil
|
||||||
}
|
}
|
||||||
hashCode, err := db.DB.Rc.Fetch(groupMemberListHashCache+groupID, time.Second*30*60, generateHash)
|
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)
|
hashCodeUint64, err := strconv.Atoi(hashCode)
|
||||||
return uint64(hashCodeUint64), err
|
return uint64(hashCodeUint64), err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user