mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 02:37:58 +08:00
Optimized code for closing amqp connection (#3219)
This commit is contained in:
parent
4790d69878
commit
3235820803
@ -137,11 +137,13 @@ class Connection extends BaseConnection implements ConnectionInterface
|
||||
public function close(): bool
|
||||
{
|
||||
try {
|
||||
if ($this->connection->getIO() instanceof KeepaliveIO) {
|
||||
$this->connection->getIO()->close();
|
||||
}
|
||||
if ($connection = $this->connection) {
|
||||
if ($connection->getIO() instanceof KeepaliveIO) {
|
||||
$connection->getIO()->close();
|
||||
}
|
||||
|
||||
$this->connection->close();
|
||||
$connection->close();
|
||||
}
|
||||
} catch (AMQPConnectionClosedException $exception) {
|
||||
$this->getLogger()->warning((string) $exception);
|
||||
} catch (\Throwable $exception) {
|
||||
|
Loading…
Reference in New Issue
Block a user