This commit is contained in:
as2252258@163.com
2021-05-04 03:09:07 +08:00
parent a8eebeb902
commit 10b4aa28fe
+4
View File
@@ -101,6 +101,7 @@ abstract class Pool extends Component
$names[] = $name;
$this->pop($channel, $name, $retain_number);
}
$this->_items = [];
if ($retain_number == 0) {
Timer::clear($this->creates);
$this->creates = -1;
@@ -128,6 +129,9 @@ abstract class Pool extends Component
*/
protected function pop($channel, $name, $retain_number): void
{
if (Coroutine::getCid() === -1) {
return;
}
while ($channel->length() > $retain_number) {
$connection = $channel->pop();
if ($connection) {