2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-04-30 08:12:30 -04:00
|
|
|
# Worker cannot be idempotent: https://gitlab.com/gitlab-org/gitlab/-/issues/218559
|
|
|
|
# rubocop:disable Scalability/IdempotentWorker
|
|
|
|
class WebHookWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2013-01-24 15:15:24 -05:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :integrations
|
2020-06-12 08:08:56 -04:00
|
|
|
loggable_arguments 2
|
2021-06-16 14:10:35 -04:00
|
|
|
data_consistency :delayed
|
2017-07-17 11:38:02 -04:00
|
|
|
sidekiq_options retry: 4, dead: false
|
2021-07-26 14:09:51 -04:00
|
|
|
urgency :low
|
|
|
|
|
|
|
|
worker_has_external_dependencies!
|
2013-01-24 15:15:24 -05:00
|
|
|
|
2015-01-23 19:10:43 -05:00
|
|
|
def perform(hook_id, data, hook_name)
|
2021-08-10 05:10:08 -04:00
|
|
|
hook = WebHook.find_by_id(hook_id)
|
|
|
|
return unless hook
|
2017-04-27 06:08:57 -04:00
|
|
|
|
2021-08-10 05:10:08 -04:00
|
|
|
data = data.with_indifferent_access
|
2021-06-09 05:10:18 -04:00
|
|
|
WebHookService.new(hook, data, hook_name, jid).execute
|
2013-01-24 15:15:24 -05:00
|
|
|
end
|
|
|
|
end
|
2021-04-30 08:12:30 -04:00
|
|
|
# rubocop:enable Scalability/IdempotentWorker
|