diff options
author | Wolfy-J <[email protected]> | 2019-05-02 21:46:20 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-05-02 21:46:20 +0300 |
commit | 0a03c583dc5ca10651cfe86e85a242360cef7971 (patch) | |
tree | 5dce9620ec847632c52db8188bad1713906a457e | |
parent | bb95a9fbd6cc7e8a2d8204417e965dc8e1282128 (diff) |
test
-rw-r--r-- | static_pool.go | 4 | ||||
-rw-r--r-- | static_pool_test.go | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/static_pool.go b/static_pool.go index 615ab00a..d3854935 100644 --- a/static_pool.go +++ b/static_pool.go @@ -3,6 +3,7 @@ package roadrunner import ( "fmt" "github.com/pkg/errors" + "log" "os/exec" "sync" "sync/atomic" @@ -203,6 +204,7 @@ func (p *StaticPool) allocateWorker() (w *Worker, err error) { } if err, remove := p.remove.Load(w); remove { + log.Println("remove") go p.destroyWorker(w, err) // get next worker @@ -239,6 +241,8 @@ func (p *StaticPool) allocateWorker() (w *Worker, err error) { return w, nil case <-p.destroy: + timeout.Stop() + return nil, fmt.Errorf("pool has been stopped") } } diff --git a/static_pool_test.go b/static_pool_test.go index a78fcf11..b1a27990 100644 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -425,7 +425,11 @@ func Benchmark_Pool_Echo_Batched(b *testing.B) { p, _ := NewPool( func() *exec.Cmd { return exec.Command("php", "tests/client.php", "echo", "pipes") }, NewPipeFactory(), - cfg, + Config{ + NumWorkers: int64(runtime.NumCPU()), + AllocateTimeout: time.Second * 100, + DestroyTimeout: time.Second, + }, ) defer p.Destroy() |