diff --git a/app/jobs/send_http_webhook_job.rb b/app/jobs/send_http_webhook_job.rb index cc27517aeff..fa0082a790a 100644 --- a/app/jobs/send_http_webhook_job.rb +++ b/app/jobs/send_http_webhook_job.rb @@ -1,6 +1,14 @@ # frozen_string_literal: true class SendHttpWebhookJob < ApplicationJob + queue_as do + if ActiveModel::Type::Boolean.new.cast(ENV['SIDEKIQ_WEBHOOK']) + :webhook_worker + else + :webhook + end + end + def perform(webhook) Webhooks::SendHttpService.call(webhook:) end diff --git a/app/jobs/send_webhook_job.rb b/app/jobs/send_webhook_job.rb index f9f542e4e8b..4c6fdd41aa4 100644 --- a/app/jobs/send_webhook_job.rb +++ b/app/jobs/send_webhook_job.rb @@ -3,7 +3,13 @@ require Rails.root.join('lib/lago_http_client/lago_http_client') class SendWebhookJob < ApplicationJob - queue_as 'webhook' + queue_as do + if ActiveModel::Type::Boolean.new.cast(ENV['SIDEKIQ_WEBHOOK']) + :webhook_worker + else + :webhook + end + end retry_on ActiveJob::DeserializationError, wait: :polynomially_longer, attempts: 6 diff --git a/config/sidekiq/sidekiq_webhook.yml b/config/sidekiq/sidekiq_webhook.yml new file mode 100644 index 00000000000..00ecbf8bc4f --- /dev/null +++ b/config/sidekiq/sidekiq_webhook.yml @@ -0,0 +1,10 @@ +concurrency: 10 +timeout: 25 +retry: 1 +queues: + - webhook_worker + +production: + concurrency: <%= ENV.fetch('SIDEKIQ_CONCURRENCY', 10) %> +staging: + concurrency: 10