summaryrefslogtreecommitdiff
path: root/static_pool.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-11 11:46:40 +0300
committerWolfy-J <[email protected]>2018-06-11 11:46:40 +0300
commit4e54066384b1f2cfb6684c781976d3a9288f1f7e (patch)
treebbda59e6be6bb6bb6e95a865be839becfecf7c19 /static_pool.go
parentf1e09d869e9a177228aadb6385ad578d2e29f90d (diff)
graceful stop
Diffstat (limited to 'static_pool.go')
-rw-r--r--static_pool.go5
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
}
}
}