Skip to content

Commit 6301488

Browse files
committed
change task func return var name
1 parent 1bc3848 commit 6301488

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

timer/timer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// TaskFunc only task function can be added to
1212
// the timer.
13-
type TaskFunc func() (notWait bool, err error)
13+
type TaskFunc func() (hasMore bool, err error)
1414

1515
// Timer is for processing task. it checks buckets
1616
// for popping jobs. it will put ready jobs to queue.
@@ -92,17 +92,17 @@ func (task taskStub) run(fetchInterval, fetchDelay time.Duration) {
9292
case <-task.ctx.Done():
9393
return
9494
default:
95-
// TODO: 添加check interval
96-
notWait, err := task.f()
95+
hasMore, err := task.f()
9796
if err != nil {
9897
task.l.Error("task run failed", log.String("err", err.Error()))
9998
time.Sleep(fetchInterval)
10099
continue
101-
} else if !notWait {
100+
} else if !hasMore {
102101
time.Sleep(fetchInterval)
103102
continue
104103
}
105104

105+
// have more jobs, wait delay time to fetch next time
106106
time.Sleep(fetchDelay)
107107
}
108108
}

0 commit comments

Comments
 (0)