Commit 2a4e09ce authored by Kerri Miller's avatar Kerri Miller

Merge branch '338707-add-temporary-rescue-in-export-memberships-worker' into 'master'

Temporarily rescue Module::DelegationError in worker

See merge request gitlab-org/gitlab!69018
parents bfba1efa 5864364b
......@@ -16,6 +16,10 @@ module Groups
@response = Groups::Memberships::ExportService.new(container: @group, current_user: @current_user).execute
send_email if @response.success?
rescue Module::DelegationError => exception
# TEMPORARY: Rescue when a User record is not available,
# see https://gitlab.com/gitlab-org/gitlab/-/issues/338707
Raven.capture_exception(exception, group_id: @group.id, user_id: @current_user.id)
end
private
......
......@@ -19,4 +19,18 @@ RSpec.describe Groups::ExportMembershipsWorker do
worker.perform(group.id, user.id)
end
context 'when there is a Module::DelegationError' do
before do
allow_next_instance_of(Groups::Memberships::ExportService) do |service|
allow(service).to receive(:execute).and_raise(Module::DelegationError)
end
end
it 'rescues the exception' do
expect(Notify).not_to receive(:memberships_export_email)
expect(Raven).to receive(:capture_exception)
worker.perform(group.id, user.id)
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