getui debug

This commit is contained in:
wangchuxiao
2022-08-09 18:48:11 +08:00
parent 2c0a2d7877
commit 706f6c6747
4 changed files with 21 additions and 19 deletions
+7 -8
View File
@@ -2,7 +2,6 @@ package cronTask
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
"Open_IM/pkg/common/log"
server_api_params "Open_IM/pkg/proto/sdk_ws"
@@ -15,19 +14,19 @@ import (
const oldestList = 0
const newestList = -1
func DeleteMongoMsgAndResetRedisSeq(operationID, ID string, diffusionType int) error {
func ResetUserGroupMinSeq(operationID, groupID, userID string) error {
return nil
}
func DeleteMongoMsgAndResetRedisSeq(operationID, userID string) error {
// -1 表示从当前最早的一个开始
var delMsgIDList []string
minSeq, err := deleteMongoMsg(operationID, ID, oldestList, &delMsgIDList)
minSeq, err := deleteMongoMsg(operationID, userID, oldestList, &delMsgIDList)
if err != nil {
return utils.Wrap(err, "")
}
log.NewDebug(operationID, utils.GetSelfFuncName(), "delMsgIDList: ", delMsgIDList)
if diffusionType == constant.WriteDiffusion {
err = db.DB.SetUserMinSeq(ID, minSeq)
} else if diffusionType == constant.ReadDiffusion {
err = db.DB.SetGroupMinSeq(ID, minSeq)
}
err = db.DB.SetUserMinSeq(userID, minSeq)
return err
}
+13 -4
View File
@@ -3,6 +3,7 @@ package cronTask
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
rocksCache "Open_IM/pkg/common/db/rocks_cache"
"Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"github.com/robfig/cron/v3"
@@ -19,8 +20,8 @@ func StartCronTask() {
if err == nil {
log.NewDebug(operationID, utils.GetSelfFuncName(), "userIDList: ", userIDList)
for _, userID := range userIDList {
if err := DeleteMongoMsgAndResetRedisSeq(operationID, userID, constant.WriteDiffusion); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), userID, constant.WriteDiffusion)
if err := DeleteMongoMsgAndResetRedisSeq(operationID, userID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), userID)
}
}
} else {
@@ -30,8 +31,16 @@ func StartCronTask() {
workingGroupIDList, err := im_mysql_model.GetGroupIDListByGroupType(constant.WorkingGroup)
if err == nil {
for _, groupID := range workingGroupIDList {
if err := DeleteMongoMsgAndResetRedisSeq(operationID, groupID, constant.ReadDiffusion); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), operationID, groupID, constant.ReadDiffusion, err.Error())
userIDList, err = rocksCache.GetGroupMemberIDListFromCache(groupID)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID)
continue
}
log.NewDebug(operationID, utils.GetSelfFuncName(), "groupID:", groupID, "userIDList:", userIDList)
for _, userID := range userIDList {
if err := ResetUserGroupMinSeq(operationID, groupID, userID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), operationID, groupID, userID, err.Error())
}
}
}
} else {