From 1e3cb7575dfc34826fdc11a03243aabd9b5a7836 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Thu, 21 Mar 2019 20:45:21 +0530 Subject: [PATCH] DEV: Update webhook event attributes even when an error raised --- app/jobs/regular/emit_web_hook_event.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/regular/emit_web_hook_event.rb b/app/jobs/regular/emit_web_hook_event.rb index 9ab18f851b4..64d680ddd53 100644 --- a/app/jobs/regular/emit_web_hook_event.rb +++ b/app/jobs/regular/emit_web_hook_event.rb @@ -72,7 +72,7 @@ module Jobs ) 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 begin @@ -107,13 +107,13 @@ module Jobs web_hook_event.update!( headers: MultiJson.dump(headers), - payload: body, status: response.status, response_headers: MultiJson.dump(response.headers), response_body: response.body, duration: ((Time.zone.now - now) * 1000).to_i ) rescue => e + web_hook_event.update!(headers: MultiJson.dump(headers)) Rails.logger.error("Webhook event failed: #{e}") end