improve package gcron

This commit is contained in:
jflyfox
2021-01-22 23:09:42 +08:00
parent 9524263803
commit ab9d7ed509
2 changed files with 7 additions and 7 deletions

View File

@ -15,11 +15,11 @@ import (
)
const (
StatusReady = gtimer.StatusReady
StatusRunning = gtimer.StatusRunning
StatusStopped = gtimer.StatusStopped
StatusClosed = gtimer.StatusClosed
gDEFAULT_TIMES = math.MaxInt32
StatusReady = gtimer.StatusReady
StatusRunning = gtimer.StatusRunning
StatusStopped = gtimer.StatusStopped
StatusClosed = gtimer.StatusClosed
defaultTimes = math.MaxInt32
)
var (

View File

@ -43,7 +43,7 @@ func (c *Cron) addEntry(pattern string, job func(), singleton bool, name ...stri
cron: c,
schedule: schedule,
jobName: runtime.FuncForPC(reflect.ValueOf(job).Pointer()).Name(),
times: gtype.NewInt(gDEFAULT_TIMES),
times: gtype.NewInt(defaultTimes),
Job: job,
Time: time.Now(),
}
@ -130,7 +130,7 @@ func (entry *Entry) check() {
}
}
if times < 2000000000 && times > 1000000000 {
entry.times.Set(gDEFAULT_TIMES)
entry.times.Set(defaultTimes)
}
glog.Path(path).Level(level).Debugf("[gcron] %s(%s) %s start", entry.Name, entry.schedule.pattern, entry.jobName)
defer func() {