diff options
Diffstat (limited to 'lib/gitlab/database/postgres_hll/buckets.rb')
-rw-r--r-- | lib/gitlab/database/postgres_hll/buckets.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/database/postgres_hll/buckets.rb b/lib/gitlab/database/postgres_hll/buckets.rb index 76818bbf340..cbc9544d905 100644 --- a/lib/gitlab/database/postgres_hll/buckets.rb +++ b/lib/gitlab/database/postgres_hll/buckets.rb @@ -38,7 +38,7 @@ module Gitlab # # @param other_buckets_hash hash with HyperLogLog structure representation def merge_hash!(other_buckets_hash) - buckets.merge!(other_buckets_hash) {|_key, old, new| new > old ? new : old } + buckets.merge!(other_buckets_hash) { |_key, old, new| new > old ? new : old } end # Serialize instance underlying HyperLogLog structure to JSON format, that can be stored in various persistence layers @@ -61,7 +61,7 @@ module Gitlab num_uniques = ( ((TOTAL_BUCKETS**2) * (0.7213 / (1 + 1.079 / TOTAL_BUCKETS))) / - (num_zero_buckets + buckets.values.sum { |bucket_hash| 2**(-1 * bucket_hash)} ) + (num_zero_buckets + buckets.values.sum { |bucket_hash| 2**(-1 * bucket_hash) } ) ).to_i if num_zero_buckets > 0 && num_uniques < 2.5 * TOTAL_BUCKETS |