class Chewy::Strategy::ActiveJob

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

Chewy.strategy(:active_job) 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

Public Instance Methods

leave() click to toggle source
# File lib/chewy/strategy/active_job.rb, line 22
def leave
  @stash.each do |type, ids|
    Chewy::Strategy::ActiveJob::Worker.perform_later(type.name, ids) unless ids.empty?
  end
end