task.go 450 B

12345678910111213141516171819202122232425
  1. package init_serve
  2. import (
  3. "eta_gn/eta_bridge/global"
  4. "eta_gn/eta_bridge/services/index_data"
  5. "github.com/robfig/cron/v3"
  6. )
  7. func InitTask() {
  8. if global.CONFIG.Serve.IsStopTask {
  9. return
  10. }
  11. c := cron.New(cron.WithSeconds())
  12. if global.CONFIG.Mysql.Binlog.IsListen {
  13. _, err := c.AddFunc("0 0 0 * * *", index_data.DeleteBeforeTenDayLog)
  14. if err != nil {
  15. global.LOG.Error("DeleteBeforeTenDayLog err" + err.Error())
  16. }
  17. }
  18. c.Start()
  19. }