Skip to content

Commit eaadf0d

Browse files
committed
simplify RR policy, avoid errors with unpopulated instance
1 parent af59c56 commit eaadf0d

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

cassandra/policies.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,11 @@ class RoundRobinPolicy(LoadBalancingPolicy):
150150
This load balancing policy is used by default.
151151
"""
152152
_live_hosts = frozenset(())
153+
_position = 0
153154

154155
def populate(self, cluster, hosts):
155156
self._live_hosts = frozenset(hosts)
156-
if len(hosts) <= 1:
157-
self._position = 0
158-
else:
157+
if len(hosts) > 1:
159158
self._position = randint(0, len(hosts) - 1)
160159

161160
def distance(self, host):

0 commit comments

Comments
 (0)