Commit 5864364b authored by Dan Jensen's avatar Dan Jensen

Temporarily rescue Module::DelegationError in worker

Groups::ExportMembershipsWorker is currently raising
Module::DelegationError in circumstances where User records are
unavailable. That is causing these workers to fail and be re-tried,
only to fail again. To avoid this impact on infrastructure while we
troubleshoot the bug, this adds a temporary rescue clause to the
worker. This clause will be removed when the bug is fixed in a
follow-up.
parent e62710d7
...@@ -16,6 +16,10 @@ module Groups ...@@ -16,6 +16,10 @@ module Groups
@response = Groups::Memberships::ExportService.new(container: @group, current_user: @current_user).execute @response = Groups::Memberships::ExportService.new(container: @group, current_user: @current_user).execute
send_email if @response.success? 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 end
private private
......
...@@ -19,4 +19,18 @@ RSpec.describe Groups::ExportMembershipsWorker do ...@@ -19,4 +19,18 @@ RSpec.describe Groups::ExportMembershipsWorker do
worker.perform(group.id, user.id) worker.perform(group.id, user.id)
end 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 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