From ea8638c8432ed5e9358ab2d24af9864bbc65c4a2 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Fri, 20 May 2022 13:01:08 +0800 Subject: [PATCH] batch to mongo --- pkg/common/db/batch_insert_chat.go | 4 ++-- pkg/common/db/redisModel.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/common/db/batch_insert_chat.go b/pkg/common/db/batch_insert_chat.go index 3ce323df9..1cc910e13 100644 --- a/pkg/common/db/batch_insert_chat.go +++ b/pkg/common/db/batch_insert_chat.go @@ -33,7 +33,7 @@ func (d *DataBases) BatchInsertChat(userID string, msgList []*pbMsg.MsgDataToMQ, msgListToMongoNext := make([]MsgInfo, 0) seqUid := "" seqUidNext := "" - log.Debug(operationID, "remain ", remain, "insertCounter ", insertCounter, "currentMaxSeq ", currentMaxSeq) + log.Debug(operationID, "remain ", remain, "insertCounter ", insertCounter, "currentMaxSeq ", currentMaxSeq, userID) for _, m := range msgList { currentMaxSeq++ sMsg := MsgInfo{} @@ -77,5 +77,5 @@ func (d *DataBases) BatchInsertChat(userID string, msgList []*pbMsg.MsgDataToMQ, } } log.NewWarn(operationID, "batch mgo cost time ", getCurrentTimestampByMill()-newTime, userID, len(msgList)) - return utils.Wrap(d.SetUserMaxSeq(userID, uint32(currentMaxSeq)), "") + return utils.Wrap(d.SetUserMaxSeq(userID, uint64(currentMaxSeq)), "") } diff --git a/pkg/common/db/redisModel.go b/pkg/common/db/redisModel.go index 01f161f84..d7165ba94 100644 --- a/pkg/common/db/redisModel.go +++ b/pkg/common/db/redisModel.go @@ -69,7 +69,7 @@ func (d *DataBases) GetUserMaxSeq(uid string) (uint64, error) { } //set the largest Seq -func (d *DataBases) SetUserMaxSeq(uid string, maxSeq uint32) error { +func (d *DataBases) SetUserMaxSeq(uid string, maxSeq uint64) error { key := userIncrSeq + uid _, err := redis.Uint64(d.Exec("SET", key, maxSeq)) return err