Avoid calling DetectRepositoryLanguagesWorker on wiki repos

parent 9fc7382d
...@@ -447,6 +447,8 @@ class Repository ...@@ -447,6 +447,8 @@ class Repository
def after_import def after_import
expire_content_cache expire_content_cache
return unless repo_type.project?
# This call is stubbed in tests due to being an expensive operation # This call is stubbed in tests due to being an expensive operation
# It can be reenabled for specific tests via: # It can be reenabled for specific tests via:
# #
......
---
title: Call DetectRepositoryLanguagesWorker only for project repositories
merge_request: 23696
author:
type: fixed
...@@ -1817,10 +1817,28 @@ describe Repository do ...@@ -1817,10 +1817,28 @@ describe Repository do
end end
describe '#after_import' do describe '#after_import' do
subject { repository.after_import }
it 'flushes and builds the cache' do it 'flushes and builds the cache' do
expect(repository).to receive(:expire_content_cache) expect(repository).to receive(:expire_content_cache)
repository.after_import subject
end
it 'calls DetectRepositoryLanguagesWorker' do
expect(DetectRepositoryLanguagesWorker).to receive(:perform_async)
subject
end
context 'with a wiki repository' do
let(:repository) { project.wiki.repository }
it 'does not call DetectRepositoryLanguagesWorker' do
expect(DetectRepositoryLanguagesWorker).not_to receive(:perform_async)
subject
end
end end
end 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