Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-03-06 14:33:42 +0300
committerShinya Maeda <shinya@gitlab.com>2018-03-06 14:33:42 +0300
commitc428aaac6613b9fcfecd479f7bb510a6e74b761c (patch)
treed042066f5be08e44de77bd22bce5829c930bd661 /app
parent6066437385fa0527e97d93fbac46eb6e455a219b (diff)
Revert unnecessary code running_or_pending_build_count removal
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/build.rb1
-rw-r--r--app/models/project.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 3f037822154..b230b7f47ef 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -359,6 +359,7 @@ 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 artifacts_metadata_entry(path, **options)
diff --git a/app/models/project.rb b/app/models/project.rb
index 58c4094918c..a11b1e4f554 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1494,6 +1494,12 @@ class Project < ActiveRecord::Base
update_column(:import_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)