From 3bdeb2948391005f3991dff87157f09abae40721 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Fri, 26 May 2023 18:44:39 +0800 Subject: [PATCH] RevokeMsg --- pkg/common/db/unrelation/msg.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pkg/common/db/unrelation/msg.go b/pkg/common/db/unrelation/msg.go index f0415ddba..41d70506d 100644 --- a/pkg/common/db/unrelation/msg.go +++ b/pkg/common/db/unrelation/msg.go @@ -201,18 +201,26 @@ func (m *MsgMongoDriver) GetMsgBySeqIndexIn1Doc(ctx context.Context, docID strin } defer cursor.Close(ctx) var doc table.MsgDocModel - //i := 0 - for cursor.Next(ctx) { - err := cursor.Decode(&doc) - if err != nil { + if cursor.Next(ctx) { + if err := cursor.Decode(&doc); err != nil { return nil, err } - //if i == 0 { - // break - //} } + ////i := 0 + //for cursor.Next(ctx) { + // err := cursor.Decode(&doc) + // if err != nil { + // return nil, err + // } + // //if i == 0 { + // // break + // //} + //} log.ZDebug(ctx, "msgInfos", "num", len(doc.Msg), "docID", docID) for _, v := range doc.Msg { + if v.Msg == nil { + continue + } if v.Msg.Seq >= beginSeq && v.Msg.Seq <= endSeq { log.ZDebug(ctx, "find msg", "msg", v.Msg) msgs = append(msgs, v)