Add the task service. Ready to tidy the go modules.

This commit is contained in:
lishuang
2020-07-11 15:25:31 +08:00
parent 096eb7c73e
commit dbeef1cee4
8 changed files with 52 additions and 213 deletions

View File

@ -4,7 +4,7 @@ import (
"fmt"
"github.com/eyebluecn/tank/code/core"
"github.com/eyebluecn/tank/code/tool/util"
"github.com/robfig/cron"
"github.com/robfig/cron/v3"
"log"
"os"
"runtime"
@ -25,13 +25,13 @@ func (this *TankLogger) Init() {
this.openFile()
this.Info("[cron job] Every day 00:00 maintain log file.")
expression := "0 0 0 * * ?"
cronJob := cron.New()
err := cronJob.AddFunc(expression, this.maintain)
entryId, err := cronJob.AddFunc(expression, this.maintain)
core.PanicError(err)
cronJob.Start()
this.Info("[cron job] Every day 00:00 maintain log file. entryId = %d", entryId)
}
func (this *TankLogger) Destroy() {