mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Merge pull request #181 from redsquirrel/unstable
Fixing inject: it was failing when there was 1 or >2 sources
This commit is contained in:
commit
7b81e5a16c
@ -319,7 +319,7 @@ class RedisTrib
|
|||||||
# divisibility. Like we have 3 nodes and need to get 10 slots, we take
|
# divisibility. Like we have 3 nodes and need to get 10 slots, we take
|
||||||
# 4 from the first, and 3 from the rest. So the biggest is always the first.
|
# 4 from the first, and 3 from the rest. So the biggest is always the first.
|
||||||
sources = sources.sort{|a,b| b.slots.length <=> a.slots.length}
|
sources = sources.sort{|a,b| b.slots.length <=> a.slots.length}
|
||||||
source_tot_slots = sources.inject {|a,b| a.slots.length+b.slots.length}
|
source_tot_slots = sources.inject(0) {|sum,source| sum+source.slots.length}
|
||||||
sources.each_with_index{|s,i|
|
sources.each_with_index{|s,i|
|
||||||
# Every node will provide a number of slots proportional to the
|
# Every node will provide a number of slots proportional to the
|
||||||
# slots it has assigned.
|
# slots it has assigned.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user