File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments