This commit is contained in:
Andy Pan 2018-05-19 13:11:21 +08:00
parent 8ff88950b8
commit 5c30d8f881
1 changed files with 4 additions and 3 deletions

View File

@ -97,13 +97,14 @@ func (p *Pool) newWorker() *Worker {
func (p *Pool) getWorker() *Worker {
var worker *Worker
if p.reachLimit() {
worker = <-p.workers
} else {
select {
case worker = <-p.workers:
return worker
case worker = <-p.workers:
return worker
default:
worker = p.newWorker()
}
}
worker = <-p.workers
return worker
}