Class: Tantot::Strategy::Chewy

Inherits:
Object
  • Object
show all
Defined in:
lib/tantot/strategy/chewy.rb

Defined Under Namespace

Classes: Worker

Instance Method Summary collapse

Instance Method Details

#run(agent, changes_by_model) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# 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