Commit a3783cde authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'fix-cache-invalidations' into 'master'

Fix Error 500 due to stale cache when projects are renamed or transferred

See merge request !3865
parent 8d7c63b7
......@@ -7,6 +7,8 @@ v 8.7.1 (unreleased)
- Fix .gitlab-ci.yml parsing issue when hidde job is a template without script definition. !3849
- Fix license detection to detect all license files, not only known licenses. !3878
- Use the `can?` helper instead of `current_user.can?`. !3882
- Prevent users from deleting Webhooks via API they do not own
- Fix Error 500 due to stale cache when projects are renamed or transferred
v 8.7.0
- Gitlab::GitAccess and Gitlab::GitAccessWiki are now instrumented
......
......@@ -820,13 +820,11 @@ class Project < ActiveRecord::Base
wiki = Repository.new("#{old_path}.wiki", self)
if repo.exists?
repo.expire_cache
repo.expire_emptiness_caches
repo.before_delete
end
if wiki.exists?
wiki.expire_cache
wiki.expire_emptiness_caches
wiki.before_delete
end
end
......
......@@ -34,6 +34,8 @@ module Projects
raise TransferError.new("Project with same path in target namespace already exists")
end
project.expire_caches_before_rename(old_path)
# Apply new namespace id and visibility level
project.namespace = new_namespace
project.visibility_level = new_namespace.visibility_level unless project.visibility_level_allowed_by_group?
......
......@@ -706,11 +706,8 @@ describe Project, models: true do
with('foo.wiki', project).
and_return(wiki)
expect(repo).to receive(:expire_cache)
expect(repo).to receive(:expire_emptiness_caches)
expect(wiki).to receive(:expire_cache)
expect(wiki).to receive(:expire_emptiness_caches)
expect(repo).to receive(:before_delete)
expect(wiki).to receive(:before_delete)
project.expire_caches_before_rename('foo')
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