RUBYCRITIC
# frozen_string_literal: true
class Accounts::Apps::Chatwoots::Webhooks::ProcessWebhookJob < ApplicationJob - Accounts::Apps::Chatwoots::Webhooks::ProcessWebhookJob has no descriptive comment
include GoodJob::ActiveJobExtensions::Concurrency
self.queue_adapter = :good_job
good_job_control_concurrency_with(
# Maximum number of jobs with the concurrency key to be
# concurrently performed (excludes enqueued jobs)
perform_limit: 1,
key: -> { "#{self.class.name}-#{arguments.last}" }
)
def perform(event, _token) - Accounts::Apps::Chatwoots::Webhooks::ProcessWebhookJob#perform doesn't depend on instance state (maybe move it to another class?)
event_hash = JSON.parse(event)
Accounts::Apps::Chatwoots::Webhooks::ProcessWebhook.call(event_hash)
end
end