Skip to content

Commit 45ed06c

Browse files
committed
oops
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 7713744 commit 45ed06c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/queue/workerpool.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,22 @@ func (p *WorkerPool) zeroBoost() {
9595
start := time.Now()
9696
pid := mq.RegisterWorkers(boost, start, false, start, cancel, false)
9797
go func() {
98-
<-ctx.Done()
98+
select {
99+
case <-ctx.Done():
100+
case <-time.After(p.boostTimeout):
101+
}
99102
mq.RemoveWorkers(pid)
100103
cancel()
101104
}()
102105
} else {
103106
log.Warn("WorkerPool: %d has zero workers - adding %d temporary workers for %s", p.qid, p.boostWorkers, p.boostTimeout)
107+
go func() {
108+
select {
109+
case <-ctx.Done():
110+
case <-time.After(p.boostTimeout):
111+
}
112+
cancel()
113+
}()
104114
}
105115
p.lock.Unlock()
106116
p.addWorkers(ctx, boost)

0 commit comments

Comments
 (0)