debian-mirror-gitlab/app/workers/web_hooks/destroy_worker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
684 B
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
module WebHooks
class DestroyWorker
include ApplicationWorker
2021-10-27 15:23:28 +05:30
data_consistency :always
2021-06-08 01:23:25 +05:30
sidekiq_options retry: 3
2021-01-03 14:25:43 +05:30
feature_category :integrations
2022-07-16 23:28:13 +05:30
urgency :high
2021-10-27 15:23:28 +05:30
2021-01-03 14:25:43 +05:30
idempotent!
def perform(user_id, web_hook_id)
user = User.find_by_id(user_id)
hook = WebHook.find_by_id(web_hook_id)
return unless user && hook
result = ::WebHooks::DestroyService.new(user).sync_destroy(hook)
return result if result[:status] == :success
e = ::WebHooks::DestroyService::DestroyError.new(result[:message])
Gitlab::ErrorTracking.track_exception(e, web_hook_id: hook.id)
raise e
end
end
end