Update pipeline newest_first to avoid subquery
What does this MR do and why?
This MR updates a class method on the pipeline model that was causing an accidental extra subquery. By making the default limit nil the subquery is avoided while preserving the ability to explicitly pass a limit when a collection of newest pipelines is desired.
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.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- open rails console while on
main
branch (ie without changes) - execute
Ci::Pipeline.latest_successful_for_ref("main")
Or use anotherpipeline.ref
depending your local db - Observe the subquery in the console output and the Pipeline record that is returned
- Switch over to this MR's branch and repeat step 1 & 2
- Observe the subquery is no longer there but the method returns the same record
Related to #455116 (closed)
Edited by Vlad Wolanyk