diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-22 21:38:08 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-03-25 13:53:59 +0300 |
commit | 63440d06647d6e2e6fb0fa9074cabf0a96cc66d3 (patch) | |
tree | cc993eea431dd246190e3cc7dcfbe7ea0c533a54 /app | |
parent | f90fa6555b66ae4d58fe6273d9c616f0938f87bc (diff) |
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
(cherry picked from commit 7ffc79829194d3be18cf66017528a90b41586054)
e64589a3 Refresh commit count after repository head changes
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 7d6f7fd2c58..4039af7a330 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1378,6 +1378,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}") |