diff options
Diffstat (limited to 'static_pool.go')
-rw-r--r-- | static_pool.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/static_pool.go b/static_pool.go index 18bfaf60..24665c01 100644 --- a/static_pool.go +++ b/static_pool.go @@ -169,13 +169,15 @@ 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 { continue } + return w, nil } } - return w, nil + return nil, fmt.Errorf("all workers are dead (%v)", p.cfg.NumWorkers) } // release releases or replaces the worker. |