Commit b2508cbd authored by Kamil Trzcinski's avatar Kamil Trzcinski

Improve performance of Pipelines API

parent 9eed507d
......@@ -20,6 +20,7 @@ class PipelinesFinder
end
scoped_pipelines.order(id: :desc)
.includes(project: [:namespace])
end
private
......
......@@ -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?
......
......@@ -33,9 +33,7 @@ class PipelineEntity < Grape::Entity
pipeline.yaml_errors.present?
end
expose :stuck?, as: :stuck do |pipeline|
pipeline.builds.any?(&:stuck?)
end
expose :stuck?, as: :stuck
end
expose :ref do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment