From 57f8021cb212eb8bed35ea13329acacf46520e99 Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Wed, 9 Nov 2011 19:06:12 -0600 Subject: [PATCH 1/1] Fixing inject: it was failing when there was 1 or >2 sources --- src/redis-trib.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis-trib.rb b/src/redis-trib.rb index fa0e8c6d..473e4922 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. -- 2.47.2