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
def after_create(issuable)
super
::MergeRequests::SyncCodeOwnerApprovalRules.new(issuable).execute
::MergeRequests::SyncCodeOwnerApprovalRulesWorker.perform_async(issuable.id)
::MergeRequests::SyncReportApproverApprovalRules.new(issuable).execute
::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
project.add_maintainer(user)
end
it 'refreshes code owners for the merge request' do
fake_refresh_service = instance_double(::MergeRequests::SyncCodeOwnerApprovalRules)
expect(::MergeRequests::SyncCodeOwnerApprovalRules)
.to receive(:new).with(kind_of(MergeRequest)).and_return(fake_refresh_service)
expect(fake_refresh_service).to receive(:execute)
service.execute
it 'schedules refresh of code owners for the merge request' do
Sidekiq::Testing.fake! do
expect { service.execute }.to change(::MergeRequests::SyncCodeOwnerApprovalRulesWorker.jobs, :size).by(1)
::MergeRequests::SyncCodeOwnerApprovalRulesWorker.clear
end
end
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