MCPcopy Create free account
hub / github.com/devfeel/dottask / startCronTask

Function startCronTask

crontask.go:137–151  ·  view source on GitHub ↗

start cron task

(task *CronTask)

Source from the content-addressed store, hash-verified

135
136//start cron task
137func startCronTask(task *CronTask) {
138 now := time.Now()
139 nowSecond := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second(), 0, time.Local)
140 afterTime := nowSecond.Add(time.Second).Sub(time.Now().Local())
141 task.TimeTicker = time.NewTicker(DefaultPeriod)
142 go func() {
143 time.Sleep(afterTime)
144 for {
145 select {
146 case <-task.TimeTicker.C:
147 doCronTask(task)
148 }
149 }
150 }()
151}
152
153func doCronTask(task *CronTask) {
154 taskCtx := task.getTaskContext()

Callers 2

StartMethod · 0.85
doCronTaskFunction · 0.85

Calls 1

doCronTaskFunction · 0.85

Tested by

no test coverage detected