From 66f91aac7070b01bd9038ddeee96a5f9ec35d858 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 31 Mar 2017 22:12:34 -0700 Subject: [PATCH] Fix N+1 query in loading pipelines in merge requests From Bullet failures in !10263 --- app/models/ci/pipeline.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index f12be98c80c..ad7e0b23ff4 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -210,7 +210,7 @@ module Ci end def stuck? - builds.pending.any?(&:stuck?) + builds.pending.includes(:project).any?(&:stuck?) end def retryable?