mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
getui debug
This commit is contained in:
parent
2c0a2d7877
commit
706f6c6747
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -227,12 +227,6 @@ const (
|
||||
WorkMomentAtUserNotification = 2
|
||||
)
|
||||
|
||||
const (
|
||||
// diffusionType
|
||||
WriteDiffusion = 0
|
||||
ReadDiffusion = 1
|
||||
)
|
||||
|
||||
const (
|
||||
AtAllString = "AtAllTag"
|
||||
AtNormal = 0
|
||||
|
@ -363,7 +363,7 @@ func (d *DataBases) DelMsgFromCache(uid string, seqList []uint32, operationID st
|
||||
result := d.RDB.Get(context.Background(), key).String()
|
||||
var msg pbCommon.MsgData
|
||||
if err := utils.String2Pb(result, &msg); err != nil {
|
||||
log2.Error(operationID, utils.GetSelfFuncName(), "String2Pb failed", msg, err.Error())
|
||||
log2.Error(operationID, utils.GetSelfFuncName(), "String2Pb failed", msg, result, key, err.Error())
|
||||
continue
|
||||
}
|
||||
msg.Status = constant.MsgDeleted
|
||||
|
Loading…
x
Reference in New Issue
Block a user