Class: Tantot::Strategy::Chewy::Worker

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

Instance Method Summary collapse

Instance Method Details

#perform(agent_id, chew_strategy, changes_by_model) ⇒ Object

Raises:



7
8
9
10
11
12
13
14
# File 'lib/tantot/strategy/chewy.rb', line 7

def perform(agent_id, chew_strategy, changes_by_model)
  agent = Tantot.agent_registry.agent(agent_id)
  raise AgentNotFound.new("No registered agent with id #{id}") unless agent

  ::Chewy.strategy(chewy_strategy) do
    agent.perform(Tantot::Strategy::Sidekiq.unmarshal(changes_by_model))
  end
end