diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-22 18:38:08 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-03-22 18:38:08 +0000 |
commit | 7ffc79829194d3be18cf66017528a90b41586054 (patch) | |
tree | e09c42cfaf7fd166c8ddf28fefc6140e0c52f815 /app | |
parent | 85a1acbe50a3db74d0298fc622170f0fd000988d (diff) | |
parent | e64589a370c9536f8701c4b7124242b2d1016ec1 (diff) | |
download | gitlab-ce-7ffc79829194d3be18cf66017528a90b41586054.tar.gz |
Merge branch 'refresh-commit-count-after-head-change' into 'master'
Refresh commit count after repository head changes
Closes #59346
See merge request gitlab-org/gitlab-ce!26473
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 1 | ||||
-rw-r--r-- | app/workers/project_cache_worker.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 14fc158ede1..611c64c8f49 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1384,6 +1384,7 @@ class Project < ActiveRecord::Base repository.raw_repository.write_ref('HEAD', "refs/heads/#{branch}") repository.copy_gitattributes(branch) repository.after_change_head + ProjectCacheWorker.perform_async(self.id, [], [:commit_count]) reload_default_branch else errors.add(:base, "Could not change HEAD: branch '#{branch}' does not exist") diff --git a/app/workers/project_cache_worker.rb b/app/workers/project_cache_worker.rb index d27b5e62574..b31099bc670 100644 --- a/app/workers/project_cache_worker.rb +++ b/app/workers/project_cache_worker.rb @@ -27,6 +27,7 @@ class ProjectCacheWorker # rubocop: enable CodeReuse/ActiveRecord def update_statistics(project, statistics = []) + return if Gitlab::Database.read_only? return unless try_obtain_lease_for(project.id, :update_statistics) Rails.logger.info("Updating statistics for project #{project.id}") |