scinote-web/app/jobs/activities/dispatch_webhooks_job.rb

20 lines
463 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Activities
2021-06-17 20:54:30 +08:00
class DispatchWebhooksJob < ApplicationJob
queue_as :high_priority
def perform(activity)
webhooks =
2021-06-18 06:13:37 +08:00
Webhook.active.where(
activity_filter_id:
Activities::ActivityFilterMatchingService.new(activity).activity_filters.select(:id)
)
webhooks.each do |webhook|
Activities::SendWebhookJob.perform_later(webhook, activity)
end
end
end
end