mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 15:00:27 +08:00
缩短监控数据清理时间为2天
This commit is contained in:
@@ -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").
|
||||
|
||||
@@ -39,5 +39,5 @@ func (this *MonitorItemValueTask) Start() {
|
||||
}
|
||||
|
||||
func (this *MonitorItemValueTask) Loop() error {
|
||||
return models.SharedNodeValueDAO.DeleteExpiredValues(nil)
|
||||
return models.SharedNodeValueDAO.Clean(nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user