improve package gcron/gtimer

This commit is contained in:
John Guo 2022-01-20 15:53:16 +08:00
parent 7401fb09c9
commit 619e256138
2 changed files with 3 additions and 2 deletions

View File

@ -172,10 +172,11 @@ func (entry *Entry) check(ctx context.Context) {
}
entry.logDebugf(ctx, "[gcron] %s %s start", entry.schedule.pattern, entry.jobName)
entry.Job(entry.timerEntry.Ctx())
entry.Job(ctx)
}
}
}
func (entry *Entry) logDebugf(ctx context.Context, format string, v ...interface{}) {
if logger := entry.cron.GetLogger(); logger != nil {
logger.Debugf(ctx, format, v...)

View File

@ -16,7 +16,7 @@ import (
// Entry is the timing job.
type Entry struct {
job JobFunc // The job function.
ctx context.Context // The context for the job.
ctx context.Context // The context for the job, for READ ONLY.
timer *Timer // Belonged timer.
ticks int64 // The job runs every tick.
times *gtype.Int // Limit running times.