Commit 6defeb0a authored by Stan Hu's avatar Stan Hu

Expire Wiki content cache after importing a repository

The cache state for Wikis that were imported via GitHub or Bitbucket does
not appear to have been flushed after a successful import.

Closes #47546
parent f646a8b9
...@@ -1615,6 +1615,7 @@ class Project < ActiveRecord::Base ...@@ -1615,6 +1615,7 @@ class Project < ActiveRecord::Base
def after_import def after_import
repository.after_import repository.after_import
wiki.repository.after_import
import_finish import_finish
remove_import_jid remove_import_jid
update_project_counter_caches update_project_counter_caches
......
---
title: Expire Wiki content cache after importing a repository
merge_request:
author:
type: fixed
...@@ -42,8 +42,6 @@ module Gitlab ...@@ -42,8 +42,6 @@ module Gitlab
klass.new(project, client, parallel: false).execute klass.new(project, client, parallel: false).execute
end end
project.repository.after_import
true true
end end
end end
......
...@@ -50,7 +50,7 @@ class GithubImport ...@@ -50,7 +50,7 @@ class GithubImport
end end
if import_success if import_success
@project.import_finish @project.after_import
puts "Import finished. Timings: #{timings}".color(:green) puts "Import finished. Timings: #{timings}".color(:green)
else else
puts "Import was not successful. Errors were as follows:" puts "Import was not successful. Errors were as follows:"
......
...@@ -30,7 +30,6 @@ describe Gitlab::GithubImport::SequentialImporter do ...@@ -30,7 +30,6 @@ describe Gitlab::GithubImport::SequentialImporter do
expect(instance).to receive(:execute) expect(instance).to receive(:execute)
end end
expect(repository).to receive(:after_import)
expect(importer.execute).to eq(true) expect(importer.execute).to eq(true)
end end
end end
......
...@@ -3391,10 +3391,11 @@ describe Project do ...@@ -3391,10 +3391,11 @@ describe Project do
end end
describe '#after_import' do describe '#after_import' do
let(:project) { build(:project) } let(:project) { create(:project) }
it 'runs the correct hooks' do it 'runs the correct hooks' do
expect(project.repository).to receive(:after_import) expect(project.repository).to receive(:after_import)
expect(project.wiki.repository).to receive(:after_import)
expect(project).to receive(:import_finish) expect(project).to receive(:import_finish)
expect(project).to receive(:update_project_counter_caches) expect(project).to receive(:update_project_counter_caches)
expect(project).to receive(:remove_import_jid) expect(project).to receive(:remove_import_jid)
......
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