Preload downstream_pipeline in CommitStatusPreloader
What does this MR do and why?
This fixes an N+1 for the commit status dropdown in places such as the stages controller, which is used to display a list of jobs on pipelines.
The additional preloads are needed for policy checks and path rendering.
In order to make this work, we also had to extend CommitStatusPreloader
with support for nested associations.
The change is behind the feature flag
preload_ci_bridge_downstream_pipelines
, disabled by default.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
In a project, create a pipeline with lots of child pipelines in a single stage. Then, with the flag preload_ci_bridge_downstream_pipelines
disabled and enabled:
- On the pipelines page, click the stage for the pipeline to trigger the load
- Once the stages have loaded, pick the corresponding
stages.json
entry in the upper right corner of the performance bar - Make note of the query count
When disabled, the query count should be quite high. When enabled, it should be significantly lower. To ensure the test is fair, make sure the requests are not being cached.
For chrome, this can be done by checking "Disable cache" for webtools network page