Commit b5dfd03e authored by Grzegorz Bizon's avatar Grzegorz Bizon

Include resources to speed up pipelines serializer

parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment