Commit 8525a708 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'run-unassign-issuables-worker-when-out-of-transaction' into 'master'

Ensure to run unassign issuables  worker when not in a transaction

See merge request gitlab-org/gitlab!36680
parents 86f1f6d6 3e92216f
...@@ -69,7 +69,7 @@ module Members ...@@ -69,7 +69,7 @@ module Members
def enqueue_unassign_issuables(member) def enqueue_unassign_issuables(member)
source_type = member.is_a?(GroupMember) ? 'Group' : 'Project' source_type = member.is_a?(GroupMember) ? 'Group' : 'Project'
member.run_after_commit do member.run_after_commit_or_now do
MembersDestroyer::UnassignIssuablesWorker.perform_async(member.user_id, member.source_id, source_type) MembersDestroyer::UnassignIssuablesWorker.perform_async(member.user_id, member.source_id, source_type)
end end
end end
......
---
title: Ensure to run unassign issuables worker when not in a transaction
merge_request: 36680
author:
type: fixed
...@@ -25,6 +25,7 @@ RSpec.describe Members::DestroyService do ...@@ -25,6 +25,7 @@ RSpec.describe Members::DestroyService do
before do before do
type = member.is_a?(GroupMember) ? 'Group' : 'Project' type = member.is_a?(GroupMember) ? 'Group' : 'Project'
expect(TodosDestroyer::EntityLeaveWorker).to receive(:perform_in).with(Todo::WAIT_FOR_DELETE, member.user_id, member.source_id, type) expect(TodosDestroyer::EntityLeaveWorker).to receive(:perform_in).with(Todo::WAIT_FOR_DELETE, member.user_id, member.source_id, type)
expect(MembersDestroyer::UnassignIssuablesWorker).to receive(:perform_async).with(member.user_id, member.source_id, type) if opts[:unassign_issuables]
end end
it 'destroys the member' do it 'destroys the member' 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