Commit 7b82a27e authored by Furkan Ayhan's avatar Furkan Ayhan

Exclude build dependency calculation when creating the pipeline

This will help us to reduce the number of queries for creating
the pipeline.
parent 31f45d7b
......@@ -17,6 +17,7 @@ module Ci
# Dependencies local to the given pipeline
def local
return [] if no_local_dependencies_specified?
return [] unless processable.pipeline_id # we don't have any dependency when creating the pipeline
deps = model_class.where(pipeline_id: processable.pipeline_id).latest
deps = from_previous_stages(deps)
......
---
title: Exclude build dependency calculation when creating the pipeline
merge_request: 59810
author:
type: performance
......@@ -259,15 +259,10 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
def expected_extra_queries
extra_jobs = 2
non_handled_sql_queries = 3
# 1. Ci::Build Load () SELECT "ci_builds".* FROM "ci_builds"
# WHERE "ci_builds"."type" = 'Ci::Build'
# AND "ci_builds"."commit_id" IS NULL
# AND ("ci_builds"."retried" = FALSE OR "ci_builds"."retried" IS NULL)
# AND (stage_idx < 1)
# 2. Ci::InstanceVariable Load => `Ci::InstanceVariable#cached_data` => already cached with `fetch_memory_cache`
# 3. Ci::Variable Load => `Project#ci_variables_for` => already cached with `Gitlab::SafeRequestStore`
non_handled_sql_queries = 2
# 1. Ci::InstanceVariable Load => `Ci::InstanceVariable#cached_data` => already cached with `fetch_memory_cache`
# 2. Ci::Variable Load => `Project#ci_variables_for` => already cached with `Gitlab::SafeRequestStore`
extra_jobs * non_handled_sql_queries
end
......
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