From b89d5ec0abd7d08579595831f9399462b85f7819 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 16 May 2023 20:28:26 +0800 Subject: [PATCH] seqs --- pkg/common/db/controller/msg.go | 8 ++++---- pkg/utils/utils.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index 6add66808..762e4f19e 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -317,7 +317,7 @@ func (db *commonMsgDatabase) getMsgBySeqs(ctx context.Context, conversationID st m := db.msg.GetDocIDSeqsMap(conversationID, seqs) var totalUnExistSeqs []int64 for docID, seqs := range m { - log.ZDebug(ctx, "getMsgBySeqsRange", "docID", docID, "seqs", seqs) + log.ZDebug(ctx, "getMsgBySeqs", "docID", docID, "seqs", seqs) seqMsgs, unexistSeqs, err := db.findMsgBySeq(ctx, docID, seqs) if err != nil { return nil, err @@ -347,8 +347,8 @@ func (db *commonMsgDatabase) refetchDelSeqsMsgs(ctx context.Context, conversatio } if len(reFetchSeqs) > 0 { m := db.msg.GetDocIDSeqsMap(conversationID, reFetchSeqs) - for docID, seq := range m { - msgs, _, err := db.findMsgBySeq(ctx, docID, seq) + for docID, seqs := range m { + msgs, _, err := db.findMsgBySeq(ctx, docID, seqs) if err != nil { return nil, err } @@ -458,7 +458,7 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange(ctx context.Context, conversation var seqs []int64 for i := end; i > end-num; i-- { if i >= begin { - seqs = append(seqs, i) + seqs = append([]int64{i}, seqs...) } else { break } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index fbb43881b..903abc78d 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -293,7 +293,7 @@ func GetSeqsBeginEnd(seqs []int64) (int64, int64) { if len(seqs) == 0 { return 0, 0 } - return seqs[len(seqs)-1], seqs[0] + return seqs[0], seqs[len(seqs)-1] } type MsgBySeq []*sdkws.MsgData