Commit c724049e authored by Sean McGivern's avatar Sean McGivern

Expire caches on Geo repo fetch

parent 26315637
...@@ -9,5 +9,8 @@ class GeoRepositoryFetchWorker ...@@ -9,5 +9,8 @@ class GeoRepositoryFetchWorker
project.create_repository unless project.repository_exists? project.create_repository unless project.repository_exists?
project.repository.after_create if project.empty_repo? project.repository.after_create if project.empty_repo?
project.repository.fetch_geo_mirror(clone_url) project.repository.fetch_geo_mirror(clone_url)
project.repository.expire_all_method_caches
project.repository.expire_branch_cache
project.repository.expire_content_cache
end end
end end
...@@ -9,6 +9,10 @@ describe GeoRepositoryFetchWorker do ...@@ -9,6 +9,10 @@ describe GeoRepositoryFetchWorker do
allow_any_instance_of(Repository).to receive(:fetch_geo_mirror).and_return(true) allow_any_instance_of(Repository).to receive(:fetch_geo_mirror).and_return(true)
allow_any_instance_of(Project).to receive(:repository_exists?) { false } allow_any_instance_of(Project).to receive(:repository_exists?) { false }
allow_any_instance_of(Project).to receive(:empty_repo?) { true } allow_any_instance_of(Project).to receive(:empty_repo?) { true }
allow_any_instance_of(Repository).to receive(:expire_all_method_caches)
allow_any_instance_of(Repository).to receive(:expire_branch_cache)
allow_any_instance_of(Repository).to receive(:expire_content_cache)
end end
it 'creates a new repository' do it 'creates a new repository' do
...@@ -28,6 +32,14 @@ describe GeoRepositoryFetchWorker do ...@@ -28,6 +32,14 @@ describe GeoRepositoryFetchWorker do
perform perform
end end
it 'expires repository caches' do
expect_any_instance_of(Repository).to receive(:expire_all_method_caches)
expect_any_instance_of(Repository).to receive(:expire_branch_cache)
expect_any_instance_of(Repository).to receive(:expire_content_cache)
perform
end
end end
def perform def perform
......
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