Merge "Add if condition for random.shuffle"
This commit is contained in:
commit
ac1cb20e0d
@ -407,6 +407,7 @@ class Connection(object):
|
|||||||
LOG.warn(_LW('Selecting the kombu transport through the '
|
LOG.warn(_LW('Selecting the kombu transport through the '
|
||||||
'transport url (%s) is a experimental feature '
|
'transport url (%s) is a experimental feature '
|
||||||
'and this is not yet supported.') % url.transport)
|
'and this is not yet supported.') % url.transport)
|
||||||
|
if len(url.hosts) > 1:
|
||||||
random.shuffle(url.hosts)
|
random.shuffle(url.hosts)
|
||||||
for host in url.hosts:
|
for host in url.hosts:
|
||||||
transport = url.transport.replace('kombu+', '')
|
transport = url.transport.replace('kombu+', '')
|
||||||
@ -425,6 +426,7 @@ class Connection(object):
|
|||||||
transport = url.transport.replace('kombu+', '')
|
transport = url.transport.replace('kombu+', '')
|
||||||
self._url = "%s://%s" % (transport, virtual_host)
|
self._url = "%s://%s" % (transport, virtual_host)
|
||||||
else:
|
else:
|
||||||
|
if len(self.rabbit_hosts) > 1:
|
||||||
random.shuffle(self.rabbit_hosts)
|
random.shuffle(self.rabbit_hosts)
|
||||||
for adr in self.rabbit_hosts:
|
for adr in self.rabbit_hosts:
|
||||||
hostname, port = netutils.parse_host_port(
|
hostname, port = netutils.parse_host_port(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user