提交 2655ff67 编写于 作者: weixin_47267244's avatar weixin_47267244

修复连接池gc导致的,多个协程读写同一个连接问题

上级 d4bd1cfe
......@@ -179,9 +179,8 @@ abstract class BaseAsyncPool extends BasePool
protected function buildQueue()
{
// 清空队列
$count = $this->getFree();
$queue = $this->queue;
for ($i = 0; $i < $count; ++$i)
while (!$queue->isEmpty())
{
$queue->pop();
}
......@@ -190,7 +189,10 @@ abstract class BaseAsyncPool extends BasePool
// 重新建立队列
foreach ($this->pool as $item)
{
$queue->push($item);
if ($item->isFree())
{
$queue->push($item);
}
}
}
}
......
......@@ -172,8 +172,8 @@ abstract class BasePool implements IPool
$pool = &$this->pool;
if (isset($pool[$hash]))
{
$pool[$hash]->release();
$resource->reset();
$pool[$hash]->release();
$this->push($resource);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册