diff --git a/service/module.go b/service/module.go index 261c578..5bff65a 100644 --- a/service/module.go +++ b/service/module.go @@ -194,7 +194,6 @@ func (slf *Module) CronFunc(cronExpr *timer.CronExpr, cb func()) *timer.Cron { cron := slf.dispatcher.CronFuncEx(cronExpr, func(cron *timer.Cron) { cb() - delete(slf.mapActiveCron,cron) }) slf.mapActiveCron[cron] = nil diff --git a/util/timer/timer.go b/util/timer/timer.go index fa5d335..34eb944 100644 --- a/util/timer/timer.go +++ b/util/timer/timer.go @@ -48,7 +48,7 @@ func (t *Timer) Cb() { if t.cbex!=nil { t.cbex(t) - }else{ + }else if t.cb!= nil { t.cb() }