This commit is contained in:
as2252258@163.com
2021-09-06 02:28:06 +08:00
parent 23a86b901d
commit 53e0163388
+7 -5
View File
@@ -48,9 +48,11 @@ class Pool extends Component
protected function pop(Channel $channel, $retain_number): void protected function pop(Channel $channel, $retain_number): void
{ {
while ($channel->length() > $retain_number) { while ($channel->length() > $retain_number) {
$connection = $channel->pop(); if (Context::inCoroutine()) {
if ($connection instanceof StopHeartbeatCheck) { $connection = $channel->pop();
$connection->stopHeartbeatCheck(); if ($connection instanceof StopHeartbeatCheck) {
$connection->stopHeartbeatCheck();
}
} }
} }
} }
@@ -217,8 +219,8 @@ class Pool extends Component
if (!isset(static::$_connections[$name])) { if (!isset(static::$_connections[$name])) {
return; return;
} }
$channel = static::$_connections[$name]; static::$_connections[$name] = null;
$this->pop($channel, 0); unset(static::$_connections[$name]);
} }