msg update

This commit is contained in:
away
2021-06-28 19:21:23 +08:00
parent 36d1585609
commit 9b4af25e26
3 changed files with 81 additions and 40 deletions

View File

@@ -8,12 +8,9 @@ package logic
import (
"Open_IM/src/common/config"
"Open_IM/src/common/db"
"Open_IM/src/common/db/mysql_model/im_mysql_model"
"Open_IM/src/common/kafka"
"Open_IM/src/common/log"
"Open_IM/src/utils"
"time"
)
var (
@@ -35,32 +32,5 @@ func init() {
func Run() {
go rpcServer.run()
go scheduleDelete()
go pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&pushCh)
}
func scheduleDelete() {
//uid, _ := im_mysql_model.SelectAllUID()
//db.DB.DelHistoryChat(0, uid)
//log.Info("", "", "sssssssssss")
//if err != nil {
// db.DB.DelHistoryChat(0, uid)
//}
for {
now := time.Now()
// 计算下一个零点
next := now.Add(time.Hour * 24)
next = time.Date(next.Year(), next.Month(), next.Day(), 0, 0, 0, 0, next.Location())
t := time.NewTimer(next.Sub(now))
<-t.C
uid, err := im_mysql_model.SelectAllUID()
if err != nil {
db.DB.DelHistoryChat(int64(config.Config.Mongo.DBRetainChatRecords), uid)
}
//以下为定时执行的操作
scheduleDelete()
}
}