Skip to content

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.

  1. open rails console while on main branch (ie without changes)
  2. execute Ci::Pipeline.latest_successful_for_ref("main") Or use another pipeline.ref depending your local db
  3. Observe the subquery in the console output and the Pipeline record that is returned
  4. Switch over to this MR's branch and repeat step 1 & 2
  5. Observe the subquery is no longer there but the method returns the same record

Related to #455116 (closed)

Edited by Vlad Wolanyk

Merge request reports

Loading