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
detail
end
override :summary
def summary
override :count_summary
def count_summary(item, count)
super
if ::Gitlab::Database::LoadBalancing.enable?
detail_store.each_with_object(super) do |item, count|
count[item[:db_role]] ||= 0
count[item[:db_role]] += 1
end
else
super
count[item[:db_role]] ||= 0
count[item[:db_role]] += 1
end
end
end
......
......@@ -29,15 +29,19 @@ module Peek
def summary
detail_store.each_with_object({}) do |item, count|
if item[:cached].present?
count[item[:cached]] ||= 0
count[item[:cached]] += 1
end
count_summary(item, count)
end
end
def count_summary(item, count)
if item[:cached].present?
count[item[:cached]] ||= 0
count[item[:cached]] += 1
end
if item[:transaction].present?
count[item[:transaction]] ||= 0
count[item[:transaction]] += 1
end
if item[:transaction].present?
count[item[:transaction]] ||= 0
count[item[:transaction]] += 1
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