From 1cb7a86e37d579e9b23e9e5041ed03c5f5a3d4a5 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sat, 4 Jan 2020 15:26:18 +0000 Subject: [PATCH] Add warning if number of workers < 0 --- modules/queue/workerpool.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/queue/workerpool.go b/modules/queue/workerpool.go index e92c1ec315..25fc7dd644 100644 --- a/modules/queue/workerpool.go +++ b/modules/queue/workerpool.go @@ -202,8 +202,11 @@ func (p *WorkerPool) addWorkers(ctx context.Context, number int) { p.lock.Lock() p.numberOfWorkers-- - if p.numberOfWorkers <= 0 { + if p.numberOfWorkers == 0 { + p.cond.Broadcast() + } else if p.numberOfWorkers < 0 { // 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.cond.Broadcast() }