bug-fixes in messaging

This commit is contained in:
Stan Lagun 2013-07-27 22:59:48 +04:00
parent e3ed6868f4
commit 6d6c29f7b5
3 changed files with 7 additions and 4 deletions

View File

@ -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):

View File

@ -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

View File

@ -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
https://github.com/istalker2/puka/releases/download/1.0.7c/puka-1.0.7c.tar.gz#egg=puka-1.0.7c