mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-28 04:48:44 +08:00
test cron
This commit is contained in:
parent
de13f5edbd
commit
22d0d80bfe
@ -84,7 +84,6 @@ func (d *delMsgRecursionStruct) getSetMinSeq() uint32 {
|
|||||||
// set minSeq 21
|
// set minSeq 21
|
||||||
// recursion
|
// recursion
|
||||||
func deleteMongoMsg(operationID string, ID string, index int64, delStruct *delMsgRecursionStruct) (uint32, error) {
|
func deleteMongoMsg(operationID string, ID string, index int64, delStruct *delMsgRecursionStruct) (uint32, error) {
|
||||||
// delMsgIDList [[uid:0, minSeq], [uid:1, minSeq]]
|
|
||||||
// find from oldest list
|
// find from oldest list
|
||||||
msgs, err := db.DB.GetUserMsgListByIndex(ID, index)
|
msgs, err := db.DB.GetUserMsgListByIndex(ID, index)
|
||||||
if err != nil || msgs.UID == "" {
|
if err != nil || msgs.UID == "" {
|
||||||
@ -106,10 +105,10 @@ func deleteMongoMsg(operationID string, ID string, index int64, delStruct *delMs
|
|||||||
if len(msgs.Msg) > db.GetSingleGocMsgNum() {
|
if len(msgs.Msg) > db.GetSingleGocMsgNum() {
|
||||||
log.NewWarn(operationID, utils.GetSelfFuncName(), "msgs too large", len(msgs.Msg), msgs.UID)
|
log.NewWarn(operationID, utils.GetSelfFuncName(), "msgs too large", len(msgs.Msg), msgs.UID)
|
||||||
}
|
}
|
||||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "get msgs: ", msgs.UID)
|
|
||||||
for i, msg := range msgs.Msg {
|
for i, msg := range msgs.Msg {
|
||||||
// 找到列表中不需要删除的消息了, 表示为递归到最后一个块
|
// 找到列表中不需要删除的消息了, 表示为递归到最后一个块
|
||||||
if utils.GetCurrentTimestampByMill() < msg.SendTime+(int64(config.Config.Mongo.DBRetainChatRecords)*24*60*60*1000) {
|
if utils.GetCurrentTimestampByMill() < msg.SendTime+(int64(config.Config.Mongo.DBRetainChatRecords)*24*60*60*1000) {
|
||||||
|
log.NewDebug(operationID, ID, "find uid", msgs.UID)
|
||||||
// 删除块失败 递归结束 返回0
|
// 删除块失败 递归结束 返回0
|
||||||
if err := delMongoMsgsPhysical(delStruct.delUidList); err != nil {
|
if err := delMongoMsgsPhysical(delStruct.delUidList); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user