Skip to content

Commit e691220

Browse files
committed
Fixed __destruct
Requires - php-amqplib/php-amqplib#170 - php-amqplib/php-amqplib#169 to work.
1 parent b23ffbb commit e691220

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

RabbitMq/BaseAmqp.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,13 @@ public function __construct(AMQPConnection $conn, AMQPChannel $ch = null, $consu
5757

5858
public function __destruct()
5959
{
60-
//TODO FIX!
61-
// if (!empty($this->getChannel()) && !empty($this->conn))
62-
// {
63-
// $this->getChannel()->close();
64-
// }
65-
//
66-
// if (!empty($this->conn))
67-
// {
68-
// $this->conn->close();
69-
// }
60+
if ($this->ch) {
61+
$this->ch->close();
62+
}
63+
64+
if ($this->conn->isConnected()) {
65+
$this->conn->close();
66+
}
7067
}
7168

7269
/**

0 commit comments

Comments
 (0)