Cap the commit page pipelines badge count at 1,000+

What does this MR do and why?

A commit can collect tens of thousands of pipelines, for example on a project that runs pipelines for other projects through schedules. On those commits the Pipelines tab badge on the commit page runs an unbounded COUNT(*) over every pipeline of the sha. That count is as expensive as the unbounded newest-pipeline lookup.

This MR switches the badge to limited_counter_with_delimiter, which wraps the count in LIMIT 1001 and shows 1,000+ above the cap.

This change was split out of !263784, which has the full query plans.

References

Screenshots or screen recordings

No visual change, except that a commit with more than 1,000 pipelines shows 1,000+ on its Pipelines tab badge.

How to set up and validate locally

  1. Open a commit page for a commit with pipelines. The Pipelines tab badge shows the count.
  2. Create more than 1,000 pipelines for one sha (FactoryBot.create_list(:ci_pipeline, 1001, project: project, sha: sha) in the console). The badge shows 1,000+.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tiger Watson

Merge request reports

Loading
Loading