Add two preference edit api.

This commit is contained in:
lishuang
2020-07-11 14:40:03 +08:00
parent 69820bfcb9
commit 096eb7c73e
9 changed files with 186 additions and 25 deletions

View File

@ -5,7 +5,6 @@ import (
"github.com/eyebluecn/tank/code/core"
"github.com/eyebluecn/tank/code/tool/util"
"github.com/robfig/cron"
"net/http"
"time"
)
@ -94,18 +93,12 @@ func (this *FootprintService) Trace(request *http.Request, duration time.Duratio
func (this *FootprintService) Bootstrap() {
this.logger.Info("[cron job] Every day 00:10 delete Footprint data 8 days ago.")
expression := "0 10 0 * * ?"
cronJob := cron.New()
err := cronJob.AddFunc(expression, this.cleanOldData)
core.PanicError(err)
cronJob.Start()
go core.RunWithRecovery(this.cleanOldData)
this.logger.Info("Immediately delete Footprint data of 8 days ago.")
go core.RunWithRecovery(this.CleanOldData)
}
func (this *FootprintService) cleanOldData() {
func (this *FootprintService) CleanOldData() {
day8Ago := time.Now()
day8Ago = day8Ago.AddDate(0, 0, -8)