summaryrefslogtreecommitdiff
path: root/src/redis-trib.rb
diff options
context:
space:
mode:
authorDave Hoover <dave.hoover@gmail.com>2011-11-09 19:06:12 -0600
committerDave Hoover <dave.hoover@gmail.com>2011-11-09 19:06:12 -0600
commit57f8021cb212eb8bed35ea13329acacf46520e99 (patch)
treed2ba19ade82cb5c995c4a4802123828a21381416 /src/redis-trib.rb
parentb90314588fc4863f2fdb6bec0a46d48385c66994 (diff)
downloadredis-57f8021cb212eb8bed35ea13329acacf46520e99.tar.gz
Fixing inject: it was failing when there was 1 or >2 sources
Diffstat (limited to 'src/redis-trib.rb')
-rwxr-xr-xsrc/redis-trib.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redis-trib.rb b/src/redis-trib.rb
index fa0e8c6dd..473e49229 100755
--- a/src/redis-trib.rb
+++ b/src/redis-trib.rb
@@ -319,7 +319,7 @@ class RedisTrib
# 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.
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|
# Every node will provide a number of slots proportional to the
# slots it has assigned.