We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f4ff057 + 398ff4e commit 6a1d6b6Copy full SHA for 6a1d6b6
1 file changed
workers/workQueue/dispatcher.go
@@ -26,7 +26,7 @@ func NewJobDispatcher() *JobDispatcher {
26
retryTimeout: DefaultRetryTimeout,
27
jobPool: NewJobPool(),
28
workerChan: make(chan chan Work),
29
- inputChan: make(chan Work),
+ inputChan: make(chan Work, 1),
30
endChan: make(chan bool),
31
EmptyQueueChan: make(chan bool),
32
}
@@ -53,7 +53,9 @@ func (j *JobDispatcher) Start() {
53
work := j.jobPool.GetNewJob()
54
if work.JobId == -1 {
55
zap.S().Infof("*** No more jobs on JobPool, waiting.... ***")
56
- j.EmptyQueueChan <- true
+ if len(j.inputChan) == 0 {
57
+ j.EmptyQueueChan <- true
58
+ }
59
time.Sleep(j.retryTimeout)
60
continue
61
0 commit comments