Expire caches after project creation to ensure a consistent state
Closes #14961
This commit is contained in:
parent
8f0945311b
commit
27b9f64efb
2 changed files with 15 additions and 0 deletions
|
@ -331,6 +331,8 @@ class Repository
|
|||
# Runs code after a repository has been created.
|
||||
def after_create
|
||||
expire_exists_cache
|
||||
expire_root_ref_cache
|
||||
expire_emptiness_caches
|
||||
end
|
||||
|
||||
# Runs code just before a repository is deleted.
|
||||
|
|
|
@ -670,6 +670,19 @@ describe Repository, models: true do
|
|||
|
||||
repository.after_create
|
||||
end
|
||||
|
||||
it 'flushes the root ref cache' do
|
||||
expect(repository).to receive(:expire_root_ref_cache)
|
||||
|
||||
repository.after_create
|
||||
end
|
||||
|
||||
it 'flushes the emptiness caches' do
|
||||
expect(repository).to receive(:expire_emptiness_caches)
|
||||
|
||||
repository.after_create
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "#main_language" do
|
||||
|
|
Loading…
Reference in a new issue