From cbff244d8816c8019d2b1ac4d43c167119fe3528 Mon Sep 17 00:00:00 2001 From: John Guo Date: Mon, 9 May 2022 21:45:57 +0800 Subject: [PATCH] improve package gcron --- os/gcron/gcron_entry.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/os/gcron/gcron_entry.go b/os/gcron/gcron_entry.go index 19df61825..f0ce842e2 100644 --- a/os/gcron/gcron_entry.go +++ b/os/gcron/gcron_entry.go @@ -78,7 +78,7 @@ func (c *Cron) doAddEntry(in doAddEntryInput) (*Entry, error) { entry.timerEntry = gtimer.AddEntry( in.Ctx, time.Second, - entry.check, + entry.checkAndRun, in.IsSingleton, -1, gtimer.StatusStopped, @@ -130,10 +130,10 @@ func (entry *Entry) Close() { entry.timerEntry.Close() } -// check is the core timing task check logic. +// checkAndRun is the core timing task check logic. // The running times limits feature is implemented by gcron.Entry and cannot be implemented by gtimer.Entry. // gcron.Entry relies on gtimer to implement a scheduled task check for gcron.Entry per second. -func (entry *Entry) check(ctx context.Context) { +func (entry *Entry) checkAndRun(ctx context.Context) { if entry.schedule.meet(time.Now()) { switch entry.cron.status.Val() { case StatusStopped: