diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-13 15:42:49 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-28 10:46:20 +0000 |
commit | 41bb23ae1d61f1e94749a288d822c93b430ee9c8 (patch) | |
tree | b223c9dc24759599e46c649300be32739775a975 /app/models | |
parent | 4fcbcce36475067f4d72ebe9371634e31073a497 (diff) | |
download | gitlab-ce-41bb23ae1d61f1e94749a288d822c93b430ee9c8.tar.gz |
Restore memoization to base query and add a batch base query method
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/cycle_analytics.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/cycle_analytics.rb b/app/models/cycle_analytics.rb index 52eb07ae7d6..8a57298f824 100644 --- a/app/models/cycle_analytics.rb +++ b/app/models/cycle_analytics.rb @@ -7,8 +7,13 @@ class CycleAnalytics end def all_medians_per_stage - STAGES.each_with_object({}) do |stage_name, hsh| - hsh[stage_name] = self[stage_name].median + medians_per_stage = {} + + # We only need this data for Postgres instances + return medians_per_stage if Gitlab::Database.mysql? + + STAGES.each do |stage_name| + medians_per_stage[stage_name] = self[stage_name].median end end |