mirror of
1
Fork 0

Add warning if number of workers < 0

This commit is contained in:
Andrew Thornton 2020-01-04 15:26:18 +00:00
parent 21b9778119
commit 1cb7a86e37
No known key found for this signature in database
GPG Key ID: 3CDE74631F13A748
1 changed files with 4 additions and 1 deletions

View File

@ -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()
} }