This commit is contained in:
as2252258@163.com
2021-09-06 01:41:57 +08:00
parent 5c68659e64
commit 9ecbb09b45
+3 -3
View File
@@ -5,6 +5,7 @@ namespace Kiri\Pool;
use Exception; use Exception;
use Http\Context\Context;
use Kiri\Abstracts\Component; use Kiri\Abstracts\Component;
use Kiri\Abstracts\Config; use Kiri\Abstracts\Config;
use Kiri\Exception\ConfigException; use Kiri\Exception\ConfigException;
@@ -46,9 +47,8 @@ class Pool extends Component
*/ */
protected function pop(Channel $channel, $retain_number): void protected function pop(Channel $channel, $retain_number): void
{ {
if ($channel instanceof Channel && Coroutine::getCid() === -1) { if ($channel instanceof Channel && !Context::inCoroutine()) {
$channel = null; $channel->close();
unset($channel);
return; return;
} }
while ($channel->length() > $retain_number) { while ($channel->length() > $retain_number) {