for RoundRobin return iterator instead of materialized list

Most of time, only first element will be consumed.
This commit is contained in:
Adam Holmberg
2015-07-17 14:29:25 -05:00
parent 33e9a99627
commit 6056b36bc8

View File

@@ -173,7 +173,7 @@ class RoundRobinPolicy(LoadBalancingPolicy):
length = len(hosts)
if length:
pos %= length
return list(islice(cycle(hosts), pos, pos + length))
return islice(cycle(hosts), pos, pos + length)
else:
return []