Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Round the target weight, to allow shards that are partially over/unde…
Browse files Browse the repository at this point in the history
…r loaded to relinquish.
  • Loading branch information
Stu Hood committed May 2, 2012
1 parent 24f3467 commit 208dc0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/gizzard/rebalancer.rb
Expand Up @@ -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
Expand Down

0 comments on commit 208dc0f

Please sign in to comment.