From 7b53524ade1bb9c669ecd5383d9cdf86f6fa765a Mon Sep 17 00:00:00 2001 From: Dmytry Scherbina Date: Wed, 10 Oct 2012 16:52:11 +0300 Subject: [PATCH] Update library/Rediska/PubSub/Channel.php Issue #74: unsubscribe error fix --- library/Rediska/PubSub/Channel.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/Rediska/PubSub/Channel.php b/library/Rediska/PubSub/Channel.php index c9f597d..ce26999 100644 --- a/library/Rediska/PubSub/Channel.php +++ b/library/Rediska/PubSub/Channel.php @@ -459,7 +459,9 @@ protected function _execCommand($command, $channels) foreach($channels as $channel) { $execCommand[] = $this->getRediska()->getOption('namespace') . $channel; } - $connection = $this->_connections->getConnectionByAlias($connectionAlias); + if (!$connection){ + $connection = $this->_connections->getConnectionByAlias($connectionAlias); + } $exec = new Rediska_Connection_Exec($connection, $execCommand); $exec->write(); } @@ -467,7 +469,9 @@ protected function _execCommand($command, $channels) // Get responses from connections while (!empty($channelsByConnections)) { foreach ($channelsByConnections as $connectionAlias => $channels) { - $connection = $this->_connections->getConnectionByAlias($connectionAlias); + if (!$connection){ + $connection = $this->_connections->getConnectionByAlias($connectionAlias); + } foreach($channels as $channel) { $response = $this->_getResponseFromConnection($connection);