diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-07-31 06:09:15 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-07-31 06:09:15 +0000 |
commit | b8ef3e94e4e6d378a59d64e1585ce3360c870b8c (patch) | |
tree | e8ab6f3b20b4bdf7a0beef6166adf4d4779c54d4 | |
parent | 8cf481c2f24696f541d27ddfe8dbce708a7d4937 (diff) | |
parent | 2a5b4a78f3adb2b180b157532247ae0a87159569 (diff) | |
download | heat-b8ef3e94e4e6d378a59d64e1585ce3360c870b8c.tar.gz |
Merge "Qpid: advance thru the list of brokers on reconnect" into stable/havana
-rw-r--r-- | heat/openstack/common/rpc/impl_qpid.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/heat/openstack/common/rpc/impl_qpid.py b/heat/openstack/common/rpc/impl_qpid.py index 044548760..3dcb88667 100644 --- a/heat/openstack/common/rpc/impl_qpid.py +++ b/heat/openstack/common/rpc/impl_qpid.py @@ -468,6 +468,10 @@ class Connection(object): self.brokers = params['qpid_hosts'] self.username = params['username'] self.password = params['password'] + + brokers_count = len(self.brokers) + self.next_broker_indices = itertools.cycle(range(brokers_count)) + self.connection_create(self.brokers[0]) self.reconnect() @@ -495,7 +499,6 @@ class Connection(object): def reconnect(self): """Handles reconnecting and re-establishing sessions and queues.""" - attempt = 0 delay = 1 while True: # Close the session if necessary @@ -505,8 +508,7 @@ class Connection(object): except qpid_exceptions.ConnectionError: pass - broker = self.brokers[attempt % len(self.brokers)] - attempt += 1 + broker = self.brokers[next(self.next_broker_indices)] try: self.connection_create(broker) |