Browse Source

Add warning if number of workers < 0

pull/9363/head
Andrew Thornton 6 years ago
parent
commit
1cb7a86e37
No known key found for this signature in database
GPG Key ID: 3CDE74631F13A748
  1. 5
      modules/queue/workerpool.go

5
modules/queue/workerpool.go

@ -202,8 +202,11 @@ func (p *WorkerPool) addWorkers(ctx context.Context, number int) {
p.lock.Lock() p.lock.Lock()
p.numberOfWorkers-- p.numberOfWorkers--
if p.numberOfWorkers <= 0 { if p.numberOfWorkers == 0 {
p.cond.Broadcast()
} else if p.numberOfWorkers < 0 {
// numberOfWorkers can't go negative but... // numberOfWorkers can't go negative but...
log.Warn("Number of Workers < 0 for QID %d - this shouldn't happen", p.qid)
p.numberOfWorkers = 0 p.numberOfWorkers = 0
p.cond.Broadcast() p.cond.Broadcast()
} }

Loading…
Cancel
Save