Commit 70a74c45 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'fj-avoid-calling-detect-languages-worker-wiki-repos' into 'master'

Call DetectRepositoryLanguagesWorker only for project repository imports

Closes #198627

See merge request gitlab-org/gitlab!23696
parents 076775ad f32cd056
......@@ -447,6 +447,8 @@ class Repository
def after_import
expire_content_cache
return unless repo_type.project?
# This call is stubbed in tests due to being an expensive operation
# 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
end
describe '#after_import' do
subject { repository.after_import }
it 'flushes and builds the cache' do
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
......
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