From 7a925f202166418634f817dffb460da2af030665 Mon Sep 17 00:00:00 2001 From: yf <291323003@qq.com> Date: Thu, 9 Aug 2018 14:20:05 +0800 Subject: [PATCH] fixbug --- src/Pool/AbstractPool.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Pool/AbstractPool.php b/src/Pool/AbstractPool.php index e4c277f..7f87ae4 100644 --- a/src/Pool/AbstractPool.php +++ b/src/Pool/AbstractPool.php @@ -27,7 +27,7 @@ abstract protected function createObject() ; public function __construct($maxNum = 10) { $this->queue = new \SplQueue(); - $this->chan = new Channel(); + $this->chan = new Channel(128); $this->max = $maxNum; } @@ -67,6 +67,10 @@ public function getObj(float $timeout = 0.1) $key = spl_object_hash($obj); //标记这个对象已经出队列了 $this->objHash[$key] = true; + //清空channel + while (!$this->queue->isEmpty()){ + $this->queue->pop(0.00001); + } return $obj; }else{ $this->createdNum--;