diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-09-12 18:13:07 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-09-14 13:20:05 +0200 |
commit | 72190099934badcb3296983a457123c9e0303060 (patch) | |
tree | e1f447f2fea15b29860475d5830016b287c81925 /app/models | |
parent | 3e999684f9c3b7306dea7a7feee90536ee100ccf (diff) | |
download | gitlab-ce-72190099934badcb3296983a457123c9e0303060.tar.gz |
Memoize the latest builds of a pipelineprojects-controller-show
This ensures that if a pipeline is present for the last commit on a
project's homepage we only run 1 query to get the builds, instead of
running 2 queries.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/36878#note_40073339
for more information.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/pipeline.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 476db384bbd..8d017b9b3b1 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -453,6 +453,10 @@ module Ci .fabricate! end + def latest_builds_with_artifacts + @latest_builds_with_artifacts ||= builds.latest.with_artifacts + end + private def ci_yaml_from_repo |