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