Sha256: 3ca36e6587711a0be883606b2a6642d61e740d5ea05816caff065ec077a83e41

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

# legacy worker for backwards compatibility when upgrading from Eventsimple <= 1.0.0
module Eventsimple
  class ReactorWorker
    include Sidekiq::Worker

    def perform(event_global_id, reactor_class)
      event = Retriable.with_context(:reactor) do
        ApplicationRecord.uncached { GlobalID::Locator.locate event_global_id }
      end
    rescue ActiveRecord::RecordNotFound
      Rails.logger.error("Event #{event_global_id} not found for reactor: #{reactor_class}")
    else
      reactor = reactor_class.constantize
      reactor.new.call(event)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eventsimple-1.1.3 lib/eventsimple/reactor_worker.rb
eventsimple-1.1.2 lib/eventsimple/reactor_worker.rb
eventsimple-1.1.1 lib/eventsimple/reactor_worker.rb
eventsimple-1.1.0 lib/eventsimple/reactor_worker.rb