High number of Pipeline#stuck? calls for new merge requests

I noticed after creating https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31220/diffs, there were 700 SQL calls!

image

There were numerous calls here:

image

as well as here:

image

My guess is that the following code may load every build and related runner without regard to doing this in a batched fashion:

    def stuck?
      pending_builds.any?(&:stuck?)
    end
Edited Sep 25, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading