Commit b1ba1aa7 authored by Jan Provaznik's avatar Jan Provaznik

Schedule requirements processing conditionally

In most cases projects do not have any requirements, so we can avoid
scheduling processing of any requirements which can be present in
build's artifacts.

Changelog: performance
EE: true
parent ac219b48
......@@ -8,7 +8,9 @@ module EE
# and `Namespace#namespace_statistics` will return stale data.
::Ci::Minutes::EmailNotificationService.new(build.project.reset).execute if ::Gitlab.com?
unless build.project.requirements.empty?
RequirementsManagement::ProcessRequirementsReportsWorker.perform_async(build.id)
end
super
end
......
......@@ -57,7 +57,15 @@ RSpec.describe BuildFinishedWorker do
end
end
it 'processes requirements reports' do
it 'does not schedule processing of requirement reports by default' do
expect(RequirementsManagement::ProcessRequirementsReportsWorker).not_to receive(:perform_async)
subject
end
it 'schedules processing of requirement reports if project has requirements' do
create(:requirement, project: project)
expect(RequirementsManagement::ProcessRequirementsReportsWorker).to receive(:perform_async)
subject
......
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