Skip to content
Browse files

More accurate pivotal results

  • Loading branch information...
1 parent cbd3edc commit 7e0a49508552cfa32656294357fc4371b012b730 Daniel Vartanov committed Dec 31, 2009
Showing with 10 additions and 8 deletions.
  1. +3 −3 lib/traffic.rb
  2. +7 −5 lib/traffic_splitter.rb
View
6 lib/traffic.rb
@@ -10,8 +10,8 @@ def local_address
@local_address ||= find_local_address
end
- def highest_five_hosts
- highest_hosts(5)
+ def highest_twenty_hosts
+ highest_hosts(20)
end
def hosts
@@ -20,7 +20,7 @@ def hosts
def highest_hosts(limit=0)
sorted_hosts = hosts.sort { |left, right| right.amount_of_traffic <=> left.amount_of_traffic }
- limit.nil? ? sorted_hosts : sorted_hosts[0..limit-1]
+ sorted_hosts[0..limit-1]
end
def grouped_by_host
View
12 lib/traffic_splitter.rb
@@ -1,10 +1,12 @@
class TrafficSplitter
def self.split_traffic!(traffic)
- hosts = traffic.daily.internal.highest_five_hosts +
- traffic.nightly.internal.highest_five_hosts +
- traffic.daily.world.highest_five_hosts +
- traffic.nightly.world.highest_five_hosts
+ hosts = traffic.daily.internal.highest_twenty_hosts +
+ traffic.nightly.internal.highest_twenty_hosts +
+ traffic.daily.world.highest_twenty_hosts +
+ traffic.nightly.world.highest_twenty_hosts
- hosts.sort { |left, right| right.amount_of_traffic <=> left.amount_of_traffic }
+ hosts.sort! { |left, right| right.amount_of_traffic <=> left.amount_of_traffic }
+
+ hosts[0..19]
end
end

0 comments on commit 7e0a495

Please sign in to comment.
Something went wrong with that request. Please try again.