diff options
author | Paco Guzman <pacoguzmanp@gmail.com> | 2016-07-20 09:31:56 +0200 |
---|---|---|
committer | Paco Guzman <pacoguzmanp@gmail.com> | 2016-07-20 09:31:56 +0200 |
commit | eb122e40a2ba8d1fe79d746deb4c7c803f8164a0 (patch) | |
tree | e06970b5054a109cef8f3ea88f4bce76e14d6f11 | |
parent | 79b02e40e5842540ceff4454f6c2c51f13fc081c (diff) | |
download | gitlab-ce-20011-incosistent-branch-cache-state.tar.gz |
Expire tags/branches repo cache before delete a repository20011-incosistent-branch-cache-state
-rw-r--r-- | app/models/repository.rb | 5 | ||||
-rw-r--r-- | spec/models/repository_spec.rb | 48 |
2 files changed, 53 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 1a2ac90da51..511df2d67c6 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -392,6 +392,11 @@ class Repository expire_cache if exists? + # expire cache that don't depend on repository data (when expiring) + expire_tags_cache + expire_tag_count_cache + expire_branches_cache + expire_branch_count_cache expire_root_ref_cache expire_emptiness_caches expire_exists_cache diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 110df6bbd22..59c5732c075 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -749,6 +749,30 @@ describe Repository, models: true do repository.before_delete end + it 'flushes the tags cache' do + expect(repository).to receive(:expire_tags_cache) + + repository.before_delete + end + + it 'flushes the tag count cache' do + expect(repository).to receive(:expire_tag_count_cache) + + repository.before_delete + end + + it 'flushes the branches cache' do + expect(repository).to receive(:expire_branches_cache) + + repository.before_delete + end + + it 'flushes the branch count cache' do + expect(repository).to receive(:expire_branch_count_cache) + + repository.before_delete + end + it 'flushes the root ref cache' do expect(repository).to receive(:expire_root_ref_cache) @@ -779,6 +803,30 @@ describe Repository, models: true do repository.before_delete end + it 'flushes the tags cache' do + expect(repository).to receive(:expire_tags_cache) + + repository.before_delete + end + + it 'flushes the tag count cache' do + expect(repository).to receive(:expire_tag_count_cache) + + repository.before_delete + end + + it 'flushes the branches cache' do + expect(repository).to receive(:expire_branches_cache) + + repository.before_delete + end + + it 'flushes the branch count cache' do + expect(repository).to receive(:expire_branch_count_cache) + + repository.before_delete + end + it 'flushes the root ref cache' do expect(repository).to receive(:expire_root_ref_cache) |