DEV: Update webhook event attributes even when an error raised
This commit is contained in:
parent
34730a0b16
commit
1e3cb7575d
|
@ -72,7 +72,7 @@ module Jobs
|
||||||
)
|
)
|
||||||
|
|
||||||
body = build_web_hook_body(args, web_hook)
|
body = build_web_hook_body(args, web_hook)
|
||||||
web_hook_event = WebHookEvent.create!(web_hook_id: web_hook.id)
|
web_hook_event = WebHookEvent.create!(web_hook_id: web_hook.id, payload: body)
|
||||||
response = nil
|
response = nil
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -107,13 +107,13 @@ module Jobs
|
||||||
|
|
||||||
web_hook_event.update!(
|
web_hook_event.update!(
|
||||||
headers: MultiJson.dump(headers),
|
headers: MultiJson.dump(headers),
|
||||||
payload: body,
|
|
||||||
status: response.status,
|
status: response.status,
|
||||||
response_headers: MultiJson.dump(response.headers),
|
response_headers: MultiJson.dump(response.headers),
|
||||||
response_body: response.body,
|
response_body: response.body,
|
||||||
duration: ((Time.zone.now - now) * 1000).to_i
|
duration: ((Time.zone.now - now) * 1000).to_i
|
||||||
)
|
)
|
||||||
rescue => e
|
rescue => e
|
||||||
|
web_hook_event.update!(headers: MultiJson.dump(headers))
|
||||||
Rails.logger.error("Webhook event failed: #{e}")
|
Rails.logger.error("Webhook event failed: #{e}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue