提交 b5dfd03e 编写于 作者: G Grzegorz Bizon

Include resources to speed up pipelines serializer

上级 ae5dc479
...@@ -12,7 +12,6 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -12,7 +12,6 @@ class Projects::PipelinesController < Projects::ApplicationController
.execute(scope: @scope) .execute(scope: @scope)
.page(params[:page]) .page(params[:page])
.per(30) .per(30)
.includes(project: :namespace)
@running_or_pending_count = PipelinesFinder @running_or_pending_count = PipelinesFinder
.new(project).execute(scope: 'running').count .new(project).execute(scope: 'running').count
......
...@@ -20,7 +20,6 @@ class PipelinesFinder ...@@ -20,7 +20,6 @@ class PipelinesFinder
end end
scoped_pipelines.order(id: :desc) scoped_pipelines.order(id: :desc)
.includes(project: [:namespace])
end end
private private
......
...@@ -5,6 +5,8 @@ class PipelineSerializer < BaseSerializer ...@@ -5,6 +5,8 @@ class PipelineSerializer < BaseSerializer
Struct.new('Pagination', :request, :response) Struct.new('Pagination', :request, :response)
def represent(resource, opts = {}) def represent(resource, opts = {})
resource = resource.includes(project: :namespace)
if paginated? if paginated?
raise InvalidResourceError unless resource.respond_to?(:page) raise InvalidResourceError unless resource.respond_to?(:page)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册