From c558bfa3eeb77750d9fec4bc65819d89aab56c4c Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Fri, 10 Mar 2023 15:06:57 +0800 Subject: [PATCH] log --- internal/tools/msg.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/tools/msg.go b/internal/tools/msg.go index e72c77179..f4b06e31f 100644 --- a/internal/tools/msg.go +++ b/internal/tools/msg.go @@ -118,12 +118,13 @@ func (c *MsgTool) FixGroupSeq(ctx context.Context, groupID string) error { func (c *MsgTool) fixGroupSeq(ctx context.Context, groupID string, userIDs []string) error { _, maxSeqMongo, maxSeqCache, err := c.msgDatabase.GetSuperGroupMinMaxSeqInMongoAndCache(ctx, groupID) if err != nil { - log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", groupID) + if err != unrelation.ErrMsgNotFound { + return nil + } return err } for _, userID := range userIDs { if _, err := c.GetAndFixGroupUserSeq(ctx, userID, groupID, maxSeqCache); err != nil { - log.NewError(tracelog.GetOperationID(ctx), "GetAndFixGroupUserSeq failed", groupID, userID, maxSeqCache) continue } } @@ -134,12 +135,12 @@ func (c *MsgTool) fixGroupSeq(ctx context.Context, groupID string, userIDs []str } func (c *MsgTool) GetAndFixUserSeqs(ctx context.Context, userID string) (maxSeqCache, maxSeqMongo int64, err error) { - _, maxSeqMongo, minSeqCache, maxSeqCache, err := c.msgDatabase.GetUserMinMaxSeqInMongoAndCache(ctx, userID) + minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache, err := c.msgDatabase.GetUserMinMaxSeqInMongoAndCache(ctx, userID) if err != nil { - log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", userID) + log.NewWarn(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", userID) return 0, 0, err } - + log.NewDebug(tracelog.GetOperationID(ctx), userID, minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache) if minSeqCache > maxSeqCache { if err := c.msgDatabase.SetUserMinSeq(ctx, userID, maxSeqCache); err != nil { log.NewError(tracelog.GetOperationID(ctx), "SetUserMinSeq failed", userID, minSeqCache, maxSeqCache)