Sha256: 666e57e0924ee41e5b4be61ec4031b96db92011a61a2e242bcf11cb3742b2722

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

module CanvasSync::LiveEvents
  class ProcessEventJob < ::CanvasSync::Job
    def perform(event)
      event = event.with_indifferent_access

      # Support Legacy-Style Event Handlers
      begin
        legacy_handler = "LiveEvents::#{event['metadata']['event_name'].camelcase}Event".constantize
        legacy_handler.perform_later(event)
        return
      rescue LoadError
      end

      handlers = CanvasSync::LiveEvents.registered_handlers
      handlers.each do |h|
        h.call(event)
      rescue => e
        throw e if Rails.env.test?
        Rails.logger.error("LiveEvent Handler raised Error: #{e}")
        Raven.captureException(e) if defined? Raven
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
canvas_sync-0.21.0.beta2 lib/canvas_sync/live_events/process_event_job.rb
canvas_sync-0.21.0.beta1 lib/canvas_sync/live_events/process_event_job.rb