Commit c06fa392 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Rebuild cache after Geo repository update

parent 74e7f50a
......@@ -9,6 +9,7 @@ class GeoRepositoryUpdateWorker
@project = Project.find(project_id)
fetch_repository(clone_url)
ProjectCacheWorker.perform_async(@project.id)
end
private
......
......@@ -32,7 +32,11 @@ class ProjectCacheWorker
return
end
update_caches(project_id)
if Gitlab::Geo.secondary?
update_geo_caches(project_id)
else
update_caches(project_id)
end
end
def update_caches(project_id)
......@@ -48,6 +52,18 @@ class ProjectCacheWorker
end
end
# Geo should only update Redis based cache, as data store in the database
# will be updated on primary and replicated to the secondaries.
def update_geo_caches(project_id)
project = Project.find(project_id)
return unless project.repository.exists?
if project.repository.root_ref
project.repository.build_cache
end
end
def try_obtain_lease_for(project_id)
self.class.lease_for(project_id).try_obtain
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