Class: CompanyReferenceEventsDispatcherJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/company_reference_events_dispatcher_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(company_id:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'app/jobs/company_reference_events_dispatcher_job.rb', line 4

def perform(company_id:)
  ReferenceEvent::DISPATCHABLE_EVENTS.each do |slug|
    dispatcher_class(slug).new(
      company_id: company_id
    ).dispatch
  rescue StandardError => e
    Sentry.capture_exception(e, extra: { company_id: company_id, event: slug })
    Rails.logger.error "Error dispatching event '#{slug}' for company #{company_id}: #{e.message}"
  end
end