summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-12-15 22:06:39 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-12-15 22:06:39 +0100
commitb2508cbdaf600bbb8fb2fd56c9891304502429b3 (patch)
tree45494ec34713bd874e8d52b4f272963242cdbd92 /app/models
parent9eed507dafbfdd09fcd51b970d633ba0fd764d78 (diff)
downloadgitlab-ce-b2508cbdaf600bbb8fb2fd56c9891304502429b3.tar.gz
Improve performance of Pipelines API
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/pipeline.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 54f73171fd4..9efda36fc0c 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -124,7 +124,7 @@ module Ci
end
def artifacts
- builds.latest.with_artifacts_not_expired
+ builds.latest.with_artifacts_not_expired.includes(project: [:namespace])
end
def project_id
@@ -173,7 +173,11 @@ module Ci
end
def manual_actions
- builds.latest.manual_actions
+ builds.latest.manual_actions.includes(project: [:namespace])
+ end
+
+ def stuck?
+ builds.pending.any?(&:stuck?)
end
def retryable?