Include resources to speed up pipelines serializer
This commit is contained in:
parent
ae5dc479e7
commit
b5dfd03efc
3 changed files with 2 additions and 2 deletions
|
@ -12,7 +12,6 @@ class Projects::PipelinesController < Projects::ApplicationController
|
|||
.execute(scope: @scope)
|
||||
.page(params[:page])
|
||||
.per(30)
|
||||
.includes(project: :namespace)
|
||||
|
||||
@running_or_pending_count = PipelinesFinder
|
||||
.new(project).execute(scope: 'running').count
|
||||
|
|
|
@ -20,7 +20,6 @@ class PipelinesFinder
|
|||
end
|
||||
|
||||
scoped_pipelines.order(id: :desc)
|
||||
.includes(project: [:namespace])
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -5,6 +5,8 @@ class PipelineSerializer < BaseSerializer
|
|||
Struct.new('Pagination', :request, :response)
|
||||
|
||||
def represent(resource, opts = {})
|
||||
resource = resource.includes(project: :namespace)
|
||||
|
||||
if paginated?
|
||||
raise InvalidResourceError unless resource.respond_to?(:page)
|
||||
|
||||
|
|
Loading…
Reference in a new issue