Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Round the target weight, to allow shards that are partially over/unde…

…r loaded to relinquish.
  • Loading branch information...
commit 208dc0f1b8cd427d63f00fae0b18b40d02bca06a 1 parent 24f3467
@stuhood stuhood authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/gizzard/rebalancer.rb
View
2  lib/gizzard/rebalancer.rb
@@ -48,7 +48,7 @@ def initialize(forwardings_to_trees, dest_templates_and_weights, wrapper, batch_
@result = dest_templates_and_weights.map do |template, weight|
weight_fraction = weight / total_weight.to_f
- approx_shards = total_shards * weight_fraction
+ approx_shards = (total_shards * weight_fraction).round
Bucket.new template, approx_shards, Set.new
end
Please sign in to comment.
Something went wrong with that request. Please try again.