Class: Chewy::Strategy::Shoryuken

Inherits:
Atomic show all
Defined in:
lib/chewy/strategy/shoryuken.rb

Overview

The strategy works the same way as atomic, but performs async index update driven by shoryuken

Chewy.strategy(:shoryuken) do User.all.map(&:save) # Does nothing here Post.all.map(&:save) # And here # It imports all the changed users and posts right here end

Defined Under Namespace

Classes: Worker

Instance Method Summary collapse

Methods inherited from Atomic

#initialize, #update

Methods inherited from Base

#name, #update

Constructor Details

This class inherits a constructor from Chewy::Strategy::Atomic

Instance Method Details

#leaveObject



26
27
28
29
30
31
# File 'lib/chewy/strategy/shoryuken.rb', line 26

def leave
  @stash.each do |type, ids|
    next if ids.empty?
    Shoryuken::Worker.perform_async({type: type.name, ids: ids}, queue: shoryuken_queue)
  end
end