summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-12-09 15:48:58 +0000
committerGerrit Code Review <review@openstack.org>2015-12-09 15:48:58 +0000
commit251df0ec1b859b5c9756185f985004c7ec23fced (patch)
treead5ad2162994d34dd0150665719f383b17397543
parent185693a6ed57e02b2f94b0fb8f14a91471605969 (diff)
parent148e8380ce1cc4f60716300b95104aaa2cf8c543 (diff)
downloadoslo-messaging-251df0ec1b859b5c9756185f985004c7ec23fced.tar.gz
Merge "Fix reconnection when heartbeat is missed"
-rw-r--r--oslo_messaging/_drivers/impl_rabbit.py6
-rw-r--r--oslo_messaging/tests/drivers/test_impl_rabbit.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py
index b9ff363..263b204 100644
--- a/oslo_messaging/_drivers/impl_rabbit.py
+++ b/oslo_messaging/_drivers/impl_rabbit.py
@@ -581,7 +581,10 @@ class Connection(object):
LOG.info(_LI("The broker has unblocked the connection"))
def ensure_connection(self):
- self.ensure(method=lambda: True)
+ # NOTE(sileht): we reset the channel and ensure
+ # the kombu underlying connection works
+ self._set_current_channel(None)
+ self.ensure(method=lambda: self.connection.connection)
def ensure(self, method, retry=None,
recoverable_error_callback=None, error_callback=None,
@@ -732,7 +735,6 @@ class Connection(object):
for tag, consumer in enumerate(self._consumers):
consumer.cancel(tag=tag)
except recoverable_errors:
- self._set_current_channel(None)
self.ensure_connection()
self._consumers = []
diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py
index 52cbfe1..114fc52 100644
--- a/oslo_messaging/tests/drivers/test_impl_rabbit.py
+++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py
@@ -897,6 +897,8 @@ class RpcKombuHATestCase(test_utils.BaseTestCase):
'kombu.connection.Connection.connect',
side_effect=self.kombu_connect))
self.useFixture(mockpatch.Patch(
+ 'kombu.connection.Connection.connection'))
+ self.useFixture(mockpatch.Patch(
'kombu.connection.Connection.channel'))
# starting from the first broker in the list