Handle no hosts when populating load balancer

This commit is contained in:
Tyler Hobbs
2013-05-03 18:17:12 -05:00
parent 9abb3d89d0
commit c7a77b8862

View File

@@ -26,7 +26,7 @@ class RoundRobinPolicy(LoadBalancingPolicy):
def populate(self, cluster, hosts):
self._live_hosts = set(hosts)
if len(hosts) == 1:
if len(hosts) <= 1:
self._position = 0
else:
self._position = randint(0, len(hosts) - 1)