DEV: decrease webhook timeout and move to 'low' priority queue. (#14038)

Previously, webhooks has 60 seconds default timeout of Excon and were added in the 'default' queue.
This commit is contained in:
Vinoth Kannan 2021-08-13 10:41:02 +05:30 committed by GitHub
parent 6597a2f7dd
commit c75500b871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -4,9 +4,12 @@ require 'excon'
module Jobs
class EmitWebHookEvent < ::Jobs::Base
sidekiq_options queue: 'low'
PING_EVENT = 'ping'
MAX_RETRY_COUNT = 4
RETRY_BACKOFF = 5
REQUEST_TIMEOUT = 20
def execute(args)
@arguments = args
@ -41,7 +44,14 @@ module Jobs
def send_webhook!
uri = URI(@web_hook.payload_url.strip)
conn = Excon.new(uri.to_s, ssl_verify_peer: @web_hook.verify_certificate, retry_limit: 0)
conn = Excon.new(
uri.to_s,
ssl_verify_peer: @web_hook.verify_certificate,
retry_limit: 0,
write_timeout: REQUEST_TIMEOUT,
read_timeout: REQUEST_TIMEOUT,
connect_timeout: REQUEST_TIMEOUT
)
web_hook_body = build_webhook_body
web_hook_event = create_webhook_event(web_hook_body)