diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-03-22 13:10:38 +0100 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-03-22 15:16:32 +0100 |
commit | e64589a370c9536f8701c4b7124242b2d1016ec1 (patch) | |
tree | 430675ab3ee1afe5d6fc4cd1a245dfa9d48cf0f4 /app | |
parent | 80fea82f3ab6afd486884020710eb01c06b048d9 (diff) | |
download | gitlab-ce-e64589a370c9536f8701c4b7124242b2d1016ec1.tar.gz |
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 4cc13f372c1..7f052079e32 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}") |