diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-12-11 12:26:14 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-12-11 12:26:14 +0000 |
commit | 43425ab3bb76ba84d4aaf3ec68c018de891f4183 (patch) | |
tree | 3e75799c2741356aebb9b7a9af34db3faab5f5c2 | |
parent | 8093aefaae695bc4407b451f8863ed1137a0e022 (diff) | |
parent | 47c6c8ebbf92c8794ebbeaca76e3728e4a748f69 (diff) | |
download | oslo-messaging-43425ab3bb76ba84d4aaf3ec68c018de891f4183.tar.gz |
Merge "Fix reconnection when heartbeat is missed" into stable/kilo
-rw-r--r-- | oslo_messaging/_drivers/impl_rabbit.py | 6 | ||||
-rw-r--r-- | oslo_messaging/tests/drivers/test_impl_rabbit.py | 2 | ||||
-rw-r--r-- | tests/drivers/test_impl_rabbit.py | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index 78b308d..f2e8a6f 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -767,7 +767,10 @@ class Connection(object): return False 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, @@ -912,7 +915,6 @@ class Connection(object): try: self._set_current_channel(self.connection.channel()) except recoverable_errors: - self._set_current_channel(None) self.ensure_connection() self.consumers = [] self.consumer_num = itertools.count(1) diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py index 011224b..e4cc1b4 100644 --- a/oslo_messaging/tests/drivers/test_impl_rabbit.py +++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py @@ -821,6 +821,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 diff --git a/tests/drivers/test_impl_rabbit.py b/tests/drivers/test_impl_rabbit.py index 7b58212..f3c2e56 100644 --- a/tests/drivers/test_impl_rabbit.py +++ b/tests/drivers/test_impl_rabbit.py @@ -725,6 +725,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 |