blob: 8f9b194f88acdaf63759a9f21fb9e4b2d33f79f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
module WebHooks
class DestroyWorker
include ApplicationWorker
DestroyError = Class.new(StandardError)
data_consistency :always
sidekiq_options retry: 3
feature_category :integrations
urgency :high
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)
result.track_and_raise_exception(as: DestroyError, web_hook_id: hook.id)
end
end
end
|