fix: delete conversation empty cache

pull/458/head
wangchuxiao 2 years ago
parent 3c10e2bb65
commit 95c19b7fac

@ -87,7 +87,7 @@ func (c *conversationDatabase) SetUsersConversationFiledTx(ctx context.Context,
if err != nil { if err != nil {
return err return err
} }
cache = cache.DelConversationIDs(NotUserIDs...).DelUserConversationIDsHash(NotUserIDs...) cache = cache.DelConversationIDs(NotUserIDs...).DelUserConversationIDsHash(NotUserIDs...).DelConvsersations(conversation.ConversationID, NotUserIDs...)
} }
return nil return nil
}); err != nil { }); err != nil {
@ -194,6 +194,7 @@ func (c *conversationDatabase) SetUserConversations(ctx context.Context, ownerUs
for _, conversation := range conversations { for _, conversation := range conversations {
if !utils.IsContain(conversation.ConversationID, existConversationIDs) { if !utils.IsContain(conversation.ConversationID, existConversationIDs) {
notExistConversations = append(notExistConversations, conversation) notExistConversations = append(notExistConversations, conversation)
cache = cache.DelConvsersations(ownerUserID, conversation.ConversationID)
} }
} }
if len(notExistConversations) > 0 { if len(notExistConversations) > 0 {
@ -228,6 +229,7 @@ func (c *conversationDatabase) CreateGroupChatConversation(ctx context.Context,
for _, v := range notExistUserIDs { for _, v := range notExistUserIDs {
conversation := relationTb.ConversationModel{ConversationType: constant.SuperGroupChatType, GroupID: groupID, OwnerUserID: v, ConversationID: conversationID} conversation := relationTb.ConversationModel{ConversationType: constant.SuperGroupChatType, GroupID: groupID, OwnerUserID: v, ConversationID: conversationID}
conversations = append(conversations, &conversation) conversations = append(conversations, &conversation)
cache = cache.DelConvsersations(v, conversationID)
} }
cache = cache.DelConversationIDs(notExistUserIDs...).DelUserConversationIDsHash(notExistUserIDs...) cache = cache.DelConversationIDs(notExistUserIDs...).DelUserConversationIDsHash(notExistUserIDs...)
if len(conversations) > 0 { if len(conversations) > 0 {

Loading…
Cancel
Save