Commit 74f0835b authored by Igor Drozdov's avatar Igor Drozdov

Preload build report results for pipeline builds

It fixes N + 1 issue
parent 2bcfaf6d
...@@ -42,6 +42,7 @@ class PipelineSerializer < BaseSerializer ...@@ -42,6 +42,7 @@ class PipelineSerializer < BaseSerializer
[ [
:cancelable_statuses, :cancelable_statuses,
:latest_statuses_ordered_by_stage, :latest_statuses_ordered_by_stage,
:latest_builds_report_results,
:manual_actions, :manual_actions,
:retryable_builds, :retryable_builds,
:scheduled_actions, :scheduled_actions,
......
---
title: Preload build report results for pipeline builds
merge_request: 37582
author:
type: performance
...@@ -231,7 +231,7 @@ RSpec.describe PipelineSerializer do ...@@ -231,7 +231,7 @@ RSpec.describe PipelineSerializer do
# :source_pipeline and :source_job # :source_pipeline and :source_job
# Existing numbers are high and require performance optimization # Existing numbers are high and require performance optimization
# https://gitlab.com/gitlab-org/gitlab/-/issues/225156 # https://gitlab.com/gitlab-org/gitlab/-/issues/225156
expected_queries = Gitlab.ee? ? 101 : 92 expected_queries = Gitlab.ee? ? 95 : 86
expect(recorded.count).to be_within(2).of(expected_queries) expect(recorded.count).to be_within(2).of(expected_queries)
expect(recorded.cached_count).to eq(0) expect(recorded.cached_count).to eq(0)
......
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