Commit 03903b0a authored by Matthias Käppler's avatar Matthias Käppler

Merge branch '337708-handle-web_hook_service-errors' into 'master'

Handle some WebHookService errors

See merge request gitlab-org/gitlab!67555
parents 7874f42c 8273de31
......@@ -14,9 +14,10 @@ class WebHookWorker
worker_has_external_dependencies!
def perform(hook_id, data, hook_name)
hook = WebHook.find(hook_id)
data = data.with_indifferent_access
hook = WebHook.find_by_id(hook_id)
return unless hook
data = data.with_indifferent_access
WebHookService.new(hook, data, hook_name, jid).execute
end
end
......
......@@ -14,7 +14,7 @@ module Gitlab
Net::OpenTimeout, Net::ReadTimeout, Net::WriteTimeout, Gitlab::HTTP::ReadTotalTimeout
].freeze
HTTP_ERRORS = HTTP_TIMEOUT_ERRORS + [
SocketError, OpenSSL::SSL::SSLError, OpenSSL::OpenSSLError,
EOFError, SocketError, OpenSSL::SSL::SSLError, OpenSSL::OpenSSLError,
Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH,
Gitlab::HTTP::BlockedUrlError, Gitlab::HTTP::RedirectionTooDeep
].freeze
......
......@@ -15,6 +15,10 @@ RSpec.describe WebHookWorker do
subject.perform(project_hook.id, data, hook_name)
end
it 'does not error when the WebHook record cannot be found' do
expect { subject.perform(non_existing_record_id, data, hook_name) }.not_to raise_error
end
it_behaves_like 'worker with data consistency',
described_class,
data_consistency: :delayed
......
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