缩短监控数据清理时间为2天

This commit is contained in:
GoEdgeLab
2021-12-06 10:15:32 +08:00
parent 4f129fa49f
commit e720e8a25b
2 changed files with 4 additions and 4 deletions

View File

@@ -55,10 +55,10 @@ func (this *NodeValueDAO) CreateValue(tx *dbs.Tx, clusterId int64, role nodeconf
})
}
// DeleteExpiredValues 清除数据
func (this *NodeValueDAO) DeleteExpiredValues(tx *dbs.Tx) error {
// Clean 清除数据
func (this *NodeValueDAO) Clean(tx *dbs.Tx) error {
// 删除N天之前的所有数据
expiredDays := 7
expiredDays := 2
day := timeutil.Format("Ymd", time.Now().AddDate(0, 0, -expiredDays))
_, err := this.Query(tx).
Where("day<:day").

View File

@@ -39,5 +39,5 @@ func (this *MonitorItemValueTask) Start() {
}
func (this *MonitorItemValueTask) Loop() error {
return models.SharedNodeValueDAO.DeleteExpiredValues(nil)
return models.SharedNodeValueDAO.Clean(nil)
}