From 6d6c29f7b552319603f04b066862cc90e1eb8d78 Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Sat, 27 Jul 2013 22:59:48 +0400 Subject: [PATCH] bug-fixes in messaging --- muranocommon/messaging/mqclient.py | 7 ++++--- muranocommon/messaging/subscription.py | 2 ++ requirements.txt | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/muranocommon/messaging/mqclient.py b/muranocommon/messaging/mqclient.py index b47a391..544361e 100644 --- a/muranocommon/messaging/mqclient.py +++ b/muranocommon/messaging/mqclient.py @@ -50,12 +50,13 @@ class MqClient(object): def connect(self): if not self._connected: promise = self._client.connect() - self._client.wait(promise, timeout=10000) - self._connected = True + if self._client.wait(promise, timeout=10) is not None: + self._connected = True def close(self): if self._connected: - self._client.close() + promise = self._client.close() + self._client.wait(promise) self._connected = False def declare(self, queue, exchange=None): diff --git a/muranocommon/messaging/subscription.py b/muranocommon/messaging/subscription.py index 1136613..c199d72 100644 --- a/muranocommon/messaging/subscription.py +++ b/muranocommon/messaging/subscription.py @@ -39,5 +39,7 @@ class Subscription(object): raise RuntimeError( "Subscription object must be used within 'with' block") msg_handle = self._client.wait(self._promise, timeout=timeout) + if msg_handle is None: + return None msg = Message(self._client, msg_handle) return msg diff --git a/requirements.txt b/requirements.txt index f3dc3c3..4479985 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ d2to1>=0.2.10,<0.3 pbr>=0.5,<0.6 anyjson eventlet>=0.9.12 -https://github.com/istalker2/puka/releases/download/1.0.7b/puka-1.0.7b.tar.gz#egg=puka-1.0.7b \ No newline at end of file +https://github.com/istalker2/puka/releases/download/1.0.7c/puka-1.0.7c.tar.gz#egg=puka-1.0.7c \ No newline at end of file