diff options
Diffstat (limited to 'static_pool.go')
-rw-r--r-- | static_pool.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/static_pool.go b/static_pool.go index bb418649..f82bc797 100644 --- a/static_pool.go +++ b/static_pool.go @@ -148,6 +148,8 @@ func (p *StaticPool) allocateWorker() (w *Worker, err error) { case w = <-p.free: if w.state.Value() == StateReady { return w, nil + } else { + continue } default: // enable timeout handler @@ -159,8 +161,11 @@ func (p *StaticPool) allocateWorker() (w *Worker, err error) { return nil, fmt.Errorf("worker timeout (%s)", p.cfg.AllocateTimeout) case w := <-p.free: timeout.Stop() + if w.state.Value() == StateReady { return w, nil + } else { + continue } } } |