|
|
|
@ -174,7 +174,7 @@ func (t *StarTimer) Run() error {
|
|
|
|
|
t.stopCtx, t.stopFn = context.WithCancel(context.Background())
|
|
|
|
|
go func() {
|
|
|
|
|
for {
|
|
|
|
|
if t.runCount+1 >= t.runLimit {
|
|
|
|
|
if t.runLimit > 0 && t.runCount >= t.runLimit {
|
|
|
|
|
t.Stop()
|
|
|
|
|
}
|
|
|
|
|
now := time.Now()
|
|
|
|
@ -185,7 +185,7 @@ func (t *StarTimer) Run() error {
|
|
|
|
|
case <-t.timer.C:
|
|
|
|
|
t.runCount++
|
|
|
|
|
t.nextDate = t.parseNextDate(t.nextDate, false)
|
|
|
|
|
if t.nextDate.Before(now) {
|
|
|
|
|
if t.nextDate.Before(now) || t.runLimit > 0 && t.runCount >= t.runLimit {
|
|
|
|
|
t.Stop()
|
|
|
|
|
}
|
|
|
|
|
for _, fn := range t.tasks {
|
|
|
|
|