module ChewyResque::Mixin

Public Instance Methods

queue_chewy_jobs() click to toggle source
# File lib/chewy_resque/mixin.rb, line 35
def queue_chewy_jobs
  ActiveSupport::Notifications.instrument('queue_jobs.chewy_resque', class: self.class.name, id: self.id) do
    self.class.indexers or return
    self.class.indexers.each do |idx|
      begin
        idx.enqueue(self)
      rescue => e
        # ResqueSpec stubs all exeptions from here in tests, even no logs
        if ChewyResque.logger.respond_to? :error
          ChewyResque.logger.error "Cannot update index #{idx.index_name}: #{e}\n#{e.backtrace}"
        end
        raise e
      end
    end
  end
end