Commit 57e660d8 authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'fix-stale-branch-count-cache' into 'master'

Fix repository cache invalidation issue when project is recreated with an empty repo

See merge request !3692
parents fc9e1be1 2ce7559d
...@@ -44,6 +44,7 @@ v 8.7.0 (unreleased) ...@@ -44,6 +44,7 @@ v 8.7.0 (unreleased)
- Update number of Todos in the sidebar when it's marked as "Done". !3600 - Update number of Todos in the sidebar when it's marked as "Done". !3600
- API: Expose 'updated_at' for issue, snippet, and merge request notes (Robert Schilling) - API: Expose 'updated_at' for issue, snippet, and merge request notes (Robert Schilling)
- API: User can leave a project through the API when not master or owner. !3613 - API: User can leave a project through the API when not master or owner. !3613
- Fix repository cache invalidation issue when project is recreated with an empty repo (Stan Hu)
v 8.6.6 v 8.6.6
- Fix error on language detection when repository has no HEAD (e.g., master branch). !3654 (Jeroen Bobbeldijk) - Fix error on language detection when repository has no HEAD (e.g., master branch). !3654 (Jeroen Bobbeldijk)
......
...@@ -253,6 +253,8 @@ class Repository ...@@ -253,6 +253,8 @@ class Repository
# This ensures this particular cache is flushed after the first commit to a # This ensures this particular cache is flushed after the first commit to a
# new repository. # new repository.
expire_emptiness_caches if empty? expire_emptiness_caches if empty?
expire_branch_count_cache
expire_tag_count_cache
end end
def expire_branch_cache(branch_name = nil) def expire_branch_cache(branch_name = nil)
......
...@@ -393,6 +393,8 @@ describe Repository, models: true do ...@@ -393,6 +393,8 @@ describe Repository, models: true do
describe '#expire_cache' do describe '#expire_cache' do
it 'expires all caches' do it 'expires all caches' do
expect(repository).to receive(:expire_branch_cache) expect(repository).to receive(:expire_branch_cache)
expect(repository).to receive(:expire_branch_count_cache)
expect(repository).to receive(:expire_tag_count_cache)
repository.expire_cache repository.expire_cache
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment