diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-04-06 15:21:25 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-04-06 15:21:25 +0200 |
commit | 93f9e71b0dc47d88f1077ccaeaeb5ea91e51c0fc (patch) | |
tree | e1c4f64fdc453407ad44b3a9ab0b795f64d57575 /app/serializers/pipeline_serializer.rb | |
parent | 62919a17e16de107c7fe9c1952567b3908a8f151 (diff) | |
download | gitlab-ce-93f9e71b0dc47d88f1077ccaeaeb5ea91e51c0fc.tar.gz |
Further optimise queries
Diffstat (limited to 'app/serializers/pipeline_serializer.rb')
-rw-r--r-- | app/serializers/pipeline_serializer.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb index d9dbd5608d6..08a664ad4bf 100644 --- a/app/serializers/pipeline_serializer.rb +++ b/app/serializers/pipeline_serializer.rb @@ -13,16 +13,18 @@ class PipelineSerializer < BaseSerializer def represent(resource, opts = {}) if resource.is_a?(ActiveRecord::Relation) - resource = resource.includes(:pending_builds, + project_includes = [ { namespace: :route }, :route ] + resource = resource.includes( :retryable_builds, :cancelable_statuses, - :manual_actions, - :artifacts, - :trigger_requests) - resource = resource.includes(pending_builds: :project) - resource = resource.includes(project: :namespace) - resource = resource.includes(manual_actions: { project: :namespace }) - resource = resource.includes(artifacts: { project: :namespace }) + :trigger_requests + ) + resource = resource.includes( + project: project_includes, + pending_builds: [:project], + manual_actions: { project: project_includes }, + artifacts: { project: project_includes } + ) end if paginated? |