class Tantot::Strategy::Chewy

Public Instance Methods

run(agent, changes_by_model) click to toggle source
# File lib/tantot/strategy/chewy.rb, line 17
def run(agent, changes_by_model)
  case ::Chewy.strategy.current.name
  when /sidekiq/
    queue = agent.options[:queue] || Tantot.config.sidekiq_queue
    ::Sidekiq::Client.push('class' => Tantot::Strategy::Chewy::Worker,
                           'args' => [agent.id, ::Chewy.strategy.current.name, Tantot::Strategy::Sidekiq.marshal(changes_by_model)],
                           'queue' => queue)
  when :bypass
    return
  else # :atomic, :urgent, any other (even nil, which we want to pass and fail in Chewy)
    Tantot::Strategy::Inline.new.run(agent, changes_by_model)
  end
end