class Smooth::Command::AsyncWorker

Public Class Methods

options(*args) click to toggle source
# File lib/smooth/command/async_worker.rb, line 7
def self.options(*args)
  send(:sidekiq_options, *args) if defined?(Sidekiq)
end

Public Instance Methods

memory_store() click to toggle source
# File lib/smooth/command/async_worker.rb, line 23
def memory_store
  Smooth.config.memory_store
end
perform(serialized_payload) click to toggle source
# File lib/smooth/command/async_worker.rb, line 11
def perform(serialized_payload)
  if hash = memory_store.read(serialized_payload)
    api, object_path, payload = hash.values_at('api', 'object_path', 'payload')
    current_user = payload['current_user'] || hash['current_user']

    chain = Smooth(api).lookup_object_by(object_path)
    chain = chain.as(current_user) if current_user

    chain.run(payload)
  end
end