Skip to content

Commit 2c54cae

Browse files
committed
Merge pull request #186 from fprochazka/patch-1
Fixed __destruct
2 parents b23ffbb + e691220 commit 2c54cae

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)