Skip to content

Fix branch loading timeout

Matija Čupić requested to merge mc/bug/branch-loading-timeout into master

What does this MR do?

Optimizes the Ci::Pipeline#latest_successful_for_refs method so that the branches page no longer times out.

The previous implementation loaded the 100 most recent successful pipelines for the specified refs then iterated over them and returned the latest ones. This was very inefficient.

The current implementation loads the most recent pipelines via SQL instead of filtering them in memory, which is much faster.

Related #337109 (closed)

How to setup and validate locally (strongly suggested)

  1. Open a project with a lot of branches
  2. Open the branches page
  3. It does not time out

Does this MR meet the acceptance criteria?

Conformity

Edited by Matija Čupić

Merge request reports