diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-22 13:30:45 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-22 13:30:45 +0300 |
commit | 6c63f96e0a26fa046fb0cc4664240e37db8b37d8 (patch) | |
tree | 60665118a4d454b2d68c4c15a6f76912b3763c4f /app/models/ci/pipeline.rb | |
parent | 9520d2ff278f12cf2e01a755b1ea12213fd22edb (diff) |
Preload number of warnings in every stage in a pipeline
This makes it possible to avoid N+1 queries when loading pipelines
table.
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r-- | app/models/ci/pipeline.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index e7569e0d31e..9462afe9e71 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -411,7 +411,7 @@ module Ci def number_of_warnings BatchLoader.for(id).batch(default_value: 0) do |pipeline_ids, loader| - Build.where(commit_id: pipeline_ids) + ::Ci::Build.where(commit_id: pipeline_ids) .latest .failed_but_allowed .group(:commit_id) |