Merge "rabbit: shuffle hosts before building kombu URL"

This commit is contained in:
Jenkins 2015-10-03 02:03:50 +00:00 committed by Gerrit Code Review
commit 29dc193179

@ -16,6 +16,7 @@ import collections
import contextlib
import functools
import os
import random
import socket
import ssl
import threading
@ -406,6 +407,7 @@ class Connection(object):
LOG.warn(_LW('Selecting the kombu transport through the '
'transport url (%s) is a experimental feature '
'and this is not yet supported.') % url.transport)
random.shuffle(url.hosts)
for host in url.hosts:
transport = url.transport.replace('kombu+', '')
transport = transport.replace('rabbit', 'amqp')
@ -423,6 +425,7 @@ class Connection(object):
transport = url.transport.replace('kombu+', '')
self._url = "%s://%s" % (transport, virtual_host)
else:
random.shuffle(self.rabbit_hosts)
for adr in self.rabbit_hosts:
hostname, port = netutils.parse_host_port(
adr, default_port=self.rabbit_port)