Commit 488afe24 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '20770-move-approval-rules-to-sidekiq1' into 'master'

Use SyncCodeOwnerApprovalRulesWorker when creating merge request

See merge request gitlab-org/gitlab!59395
parents 9c46b6e9 f9548536
...@@ -9,7 +9,7 @@ module EE ...@@ -9,7 +9,7 @@ module EE
def after_create(issuable) def after_create(issuable)
super super
::MergeRequests::SyncCodeOwnerApprovalRules.new(issuable).execute ::MergeRequests::SyncCodeOwnerApprovalRulesWorker.perform_async(issuable.id)
::MergeRequests::SyncReportApproverApprovalRules.new(issuable).execute ::MergeRequests::SyncReportApproverApprovalRules.new(issuable).execute
::MergeRequests::UpdateBlocksService ::MergeRequests::UpdateBlocksService
......
---
title: Sync code owner approval rules asynchronously after creating merge request
merge_request: 59395
author:
type: performance
...@@ -28,14 +28,11 @@ RSpec.describe MergeRequests::CreateService do ...@@ -28,14 +28,11 @@ RSpec.describe MergeRequests::CreateService do
project.add_maintainer(user) project.add_maintainer(user)
end end
it 'refreshes code owners for the merge request' do it 'schedules refresh of code owners for the merge request' do
fake_refresh_service = instance_double(::MergeRequests::SyncCodeOwnerApprovalRules) Sidekiq::Testing.fake! do
expect { service.execute }.to change(::MergeRequests::SyncCodeOwnerApprovalRulesWorker.jobs, :size).by(1)
expect(::MergeRequests::SyncCodeOwnerApprovalRules) ::MergeRequests::SyncCodeOwnerApprovalRulesWorker.clear
.to receive(:new).with(kind_of(MergeRequest)).and_return(fake_refresh_service) end
expect(fake_refresh_service).to receive(:execute)
service.execute
end end
context 'report approvers' do context 'report approvers' do
......
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