cron add log and fix cron

This commit is contained in:
wangchuxiao
2023-07-12 11:33:08 +08:00
parent c42a47b6b9
commit a23ecb1710
4 changed files with 14 additions and 8 deletions
+3
View File
@@ -1,6 +1,7 @@
package tools
import (
"context"
"time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
@@ -9,12 +10,14 @@ import (
)
func (c *MsgTool) ConversationsDestructMsgs() {
log.ZInfo(context.Background(), "start msg destruct cron task")
ctx := mcontext.NewCtx(utils.GetSelfFuncName())
conversations, err := c.conversationDatabase.GetConversationIDsNeedDestruct(ctx)
if err != nil {
log.ZError(ctx, "get conversation id need destruct failed", err)
return
}
log.ZDebug(context.Background(), "nums conversations need destruct", len(conversations))
for _, conversation := range conversations {
log.ZDebug(ctx, "UserMsgsDestruct", "conversationID", conversation.ConversationID, "ownerUserID", conversation.OwnerUserID, "msgDestructTime", conversation.MsgDestructTime, "lastMsgDestructTime", conversation.LatestMsgDestructTime)
seqs, err := c.msgDatabase.UserMsgsDestruct(ctx, conversation.OwnerUserID, conversation.ConversationID, conversation.MsgDestructTime, conversation.LatestMsgDestructTime)