Skip to content

Commit

Permalink
redis msg cache
Browse files Browse the repository at this point in the history
  • Loading branch information
withchao committed Dec 26, 2024
1 parent 9a009a6 commit 9d64781
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 0 additions & 6 deletions pkg/common/storage/controller/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,6 @@ func (db *commonMsgDatabase) GetMessagesBySeqWithBounds(ctx context.Context, use
}

func (db *commonMsgDatabase) DeleteMsgsPhysicalBySeqs(ctx context.Context, conversationID string, allSeqs []int64) error {
if err := db.msgCache.DelMessageBySeqs(ctx, conversationID, allSeqs); err != nil {
return err
}
for docID, seqs := range db.msgTable.GetDocIDSeqsMap(conversationID, allSeqs) {
var indexes []int
for _, seq := range seqs {
Expand All @@ -548,9 +545,6 @@ func (db *commonMsgDatabase) DeleteMsgsPhysicalBySeqs(ctx context.Context, conve
}

func (db *commonMsgDatabase) DeleteUserMsgsBySeqs(ctx context.Context, userID string, conversationID string, seqs []int64) error {
if err := db.msgCache.DelMessageBySeqs(ctx, conversationID, seqs); err != nil {
return err
}
for docID, seqs := range db.msgTable.GetDocIDSeqsMap(conversationID, seqs) {
for _, seq := range seqs {
if _, err := db.msgDocDatabase.PushUnique(ctx, docID, db.msgTable.GetMsgIndex(seq), "del_list", []string{userID}); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/common/storage/controller/msg_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ func (db *msgTransferDatabase) BatchInsertChat2DB(ctx context.Context, conversat
if err := db.BatchInsertBlock(ctx, conversationID, msgs, updateKeyMsg, msgList[0].Seq); err != nil {
return err
}
return db.msgCache.DelMessageBySeqs(ctx, conversationID, seqs)
//return db.msgCache.DelMessageBySeqs(ctx, conversationID, seqs)
return nil
}

func (db *msgTransferDatabase) BatchInsertBlock(ctx context.Context, conversationID string, fields []any, key int8, firstSeq int64) error {
Expand Down

0 comments on commit 9d64781

Please sign in to comment.