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

Patch a different method to prevent re-iteration

parent 68fd4406
...@@ -17,15 +17,13 @@ module EE ...@@ -17,15 +17,13 @@ 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
else
super
end end
end end
end end
......
...@@ -29,15 +29,19 @@ module Peek ...@@ -29,15 +29,19 @@ module Peek
def summary def summary
detail_store.each_with_object({}) do |item, count| detail_store.each_with_object({}) do |item, count|
if item[:cached].present? count_summary(item, count)
count[item[:cached]] ||= 0 end
count[item[:cached]] += 1 end
end
def count_summary(item, count)
if item[:cached].present?
count[item[:cached]] ||= 0
count[item[:cached]] += 1
end
if item[:transaction].present? if item[:transaction].present?
count[item[:transaction]] ||= 0 count[item[:transaction]] ||= 0
count[item[:transaction]] += 1 count[item[:transaction]] += 1
end
end end
end end
......
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