Skip to content

Commit 72dedbb

Browse files
author
Bulat Shakirzyanov
committed
prevent infinite looping in the replication strategy
1 parent 46d920d commit 72dedbb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/cassandra/cluster/schema/replication_strategies/network_topology.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def replication_map(token_hosts, token_ring, replication_options)
5656

5757
j = -1
5858

59-
loop do
59+
until ring.empty?
6060
break if added_replicas.size >= factor
6161

6262
j += 1
63-
tk = ring[(i + j) % size]
63+
tk = ring.delete((i + j) % size)
6464

6565
next unless tk
6666

0 commit comments

Comments
 (0)