diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-06-04 21:34:11 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-06-04 21:34:11 +0200 |
commit | f12ee2a2f490e6d126ac6345a5ad7cbf12833791 (patch) | |
tree | c1669f129d10a1b903214a836cf02265f3d0b28d | |
parent | 3571b97effd81f9a84f238f918544c6e5c625b76 (diff) | |
download | gitlab-ce-f12ee2a2f490e6d126ac6345a5ad7cbf12833791.tar.gz |
Remove unused running_or_pending_build_countremove-unused-query-in-hooks
-rw-r--r-- | app/models/ci/build.rb | 1 | ||||
-rw-r--r-- | app/models/project.rb | 6 | ||||
-rw-r--r-- | changelogs/unreleased/remove-unused-query-in-hooks.yml | 5 | ||||
-rw-r--r-- | spec/features/projects/jobs/user_browses_job_spec.rb | 2 |
4 files changed, 5 insertions, 9 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 75fd55a8f7b..7cf4dda178a 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -403,7 +403,6 @@ module Ci project.execute_hooks(build_data.dup, :job_hooks) project.execute_services(build_data.dup, :job_hooks) PagesService.new(build_data).execute - project.running_or_pending_build_count(force: true) end def browsable_artifacts? diff --git a/app/models/project.rb b/app/models/project.rb index 32298fc7f5c..a094dbcb747 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1649,12 +1649,6 @@ class Project < ActiveRecord::Base import_state.update_column(:jid, nil) end - def running_or_pending_build_count(force: false) - Rails.cache.fetch(['projects', id, 'running_or_pending_build_count'], force: force) do - builds.running_or_pending.count(:all) - end - end - # Lazy loading of the `pipeline_status` attribute def pipeline_status @pipeline_status ||= Gitlab::Cache::Ci::ProjectPipelineStatus.load_for_project(self) diff --git a/changelogs/unreleased/remove-unused-query-in-hooks.yml b/changelogs/unreleased/remove-unused-query-in-hooks.yml new file mode 100644 index 00000000000..ef40b2db5a9 --- /dev/null +++ b/changelogs/unreleased/remove-unused-query-in-hooks.yml @@ -0,0 +1,5 @@ +--- +title: Remove unused running_or_pending_build_count +merge_request: +author: +type: performance diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb index bff5bbe99af..ce0b38b7239 100644 --- a/spec/features/projects/jobs/user_browses_job_spec.rb +++ b/spec/features/projects/jobs/user_browses_job_spec.rb @@ -32,8 +32,6 @@ describe 'User browses a job', :js do page.within('.erased') do expect(page).to have_content('Job has been erased') end - - expect(build.project.running_or_pending_build_count).to eq(build.project.builds.running_or_pending.count(:all)) end context 'with a failed job' do |