Commit 94aee0e4 authored by Igor Drozdov's avatar Igor Drozdov

Reduce number of scanned commits for code intelligence

The query with passed 10 commits turned out to be slow
We can change the number to 2 until we have an optimized query
parent 019592f1
---
title: Reduce number of scanned commits for code intelligence
merge_request: 36093
author:
type: performance
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
include Gitlab::Routing include Gitlab::Routing
LATEST_COMMITS_LIMIT = 10 LATEST_COMMITS_LIMIT = 2
def initialize(project, commit_sha) def initialize(project, commit_sha)
@project = project @project = project
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Gitlab::CodeNavigationPath do RSpec.describe Gitlab::CodeNavigationPath do
context 'when there is an artifact with code navigation data' do context 'when there is an artifact with code navigation data' do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let_it_be(:sha) { project.repository.commits('master', limit: 5).last.id } let_it_be(:sha) { project.repository.commits('master', limit: Gitlab::CodeNavigationPath::LATEST_COMMITS_LIMIT).last.id }
let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: sha) } let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: sha) }
let_it_be(:job) { create(:ci_build, pipeline: pipeline) } let_it_be(:job) { create(:ci_build, pipeline: pipeline) }
let_it_be(:artifact) { create(:ci_job_artifact, :lsif, job: job) } let_it_be(:artifact) { create(:ci_job_artifact, :lsif, job: job) }
......
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