diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb index 30bda65374b9dd32c5010f39156e113940c211ed..8ba2fe692e4a5432ec8246a568ae2fb7fbc52e0a 100644 --- a/app/models/concerns/routable.rb +++ b/app/models/concerns/routable.rb @@ -103,8 +103,11 @@ def full_name def full_path return uncached_full_path unless RequestStore.active? - key = "routable/full_path/#{self.class.name}/#{self.id}" - RequestStore[key] ||= uncached_full_path + RequestStore[full_path_key] ||= uncached_full_path + end + + def expires_full_path_cache + RequestStore.delete(full_path_key) if RequestStore.active? end def build_full_path @@ -135,6 +138,10 @@ def full_path_changed? path_changed? || parent_changed? end + def full_path_key + @full_path_key ||= "routable/full_path/#{self.class.name}/#{self.id}" + end + def build_full_name if parent && name parent.human_name + ' / ' + name diff --git a/app/models/project.rb b/app/models/project.rb index 8253621f28934e4b30462250edf6ebd37442f6a5..cab984ac95cf5ba660c08c866b7d6ee425ae8b35 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -972,6 +972,7 @@ def rename_repo begin gitlab_shell.mv_repository(repository_storage_path, "#{old_path_with_namespace}.wiki", "#{new_path_with_namespace}.wiki") send_move_instructions(old_path_with_namespace) + expires_full_path_cache @old_path_with_namespace = old_path_with_namespace diff --git a/changelogs/unreleased-ee/fix-2801.yml b/changelogs/unreleased-ee/fix-2801.yml new file mode 100644 index 0000000000000000000000000000000000000000..4f1ba1832394db18fe09c8f94c3910f08de36031 --- /dev/null +++ b/changelogs/unreleased-ee/fix-2801.yml @@ -0,0 +1,4 @@ +--- +title: Geo - Fix project rename on secondary nodes +merge_request: +author: diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 840e6327a519475ca4c703cc4535f4f5a9b5eb28..53b65c560ebb3306d95dfe4b56b897d3afb90c05 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1457,6 +1457,8 @@ def create_pipeline expect(project).to receive(:expire_caches_before_rename) + expect(project).to receive(:expires_full_path_cache) + project.rename_repo end