Module: ActiveJob::Arguments

Extended by:
Arguments
Included in:
Arguments
Defined in:
lib/eventsimple/active_job/arguments.rb

Instance Method Summary collapse

Instance Method Details

#deserialize_global_id(hash) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/eventsimple/active_job/arguments.rb', line 7

def deserialize_global_id(hash)
  gid = GlobalID.parse(hash[GLOBALID_KEY])
  # For non database based processors like sidekiq, the reactor may trigger before the
  # transaction is committed. Attempt to wait for the transaction to be commited before
  # running the reactor. This is not a perfect solution, but it's better than nothing.
  if Eventsimple.configuration.retry_reactor_on_record_not_found
    Retriable.with_context(:reactor) do
      gid.model_class.uncached { GlobalID::Locator.locate hash[GLOBALID_KEY] }
    end
  else
    GlobalID::Locator.locate hash[GLOBALID_KEY]
  end
end