Commit d38671b9 authored by Quang-Minh Nguyen's avatar Quang-Minh Nguyen

Patch a different method to prevent re-iteration

parent 68fd4406
...@@ -17,16 +17,14 @@ module EE ...@@ -17,16 +17,14 @@ module EE
detail detail
end end
override :summary override :count_summary
def summary def count_summary(item, count)
super
if ::Gitlab::Database::LoadBalancing.enable? if ::Gitlab::Database::LoadBalancing.enable?
detail_store.each_with_object(super) do |item, count|
count[item[:db_role]] ||= 0 count[item[:db_role]] ||= 0
count[item[:db_role]] += 1 count[item[:db_role]] += 1
end end
else
super
end
end end
end end
end end
......
...@@ -29,6 +29,11 @@ module Peek ...@@ -29,6 +29,11 @@ module Peek
def summary def summary
detail_store.each_with_object({}) do |item, count| detail_store.each_with_object({}) do |item, count|
count_summary(item, count)
end
end
def count_summary(item, count)
if item[:cached].present? if item[:cached].present?
count[item[:cached]] ||= 0 count[item[:cached]] ||= 0
count[item[:cached]] += 1 count[item[:cached]] += 1
...@@ -39,7 +44,6 @@ module Peek ...@@ -39,7 +44,6 @@ module Peek
count[item[:transaction]] += 1 count[item[:transaction]] += 1
end end
end end
end
def setup_subscribers def setup_subscribers
super super
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment