Sha256: 367a6c594292d89da100d353a95006888fc089b460c34b49bda74c4e8e122db4
Contents?: true
Size: 569 Bytes
Versions: 1
Compression:
Stored size: 569 Bytes
Contents
require "sucker_punch" class ActiveSearch::Algolia::Worker include SuckerPunch::Job def perform(msg) begin case msg[:task] when :reindex ::ActiveSearch::Algolia::Client.new.save(msg[:id], msg[:doc]) when :deindex client = ::ActiveSearch::Algolia::Client.new client.find_from_resource(msg[:type], msg[:id]).each do |hit| client.delete(hit["objectID"]) end end rescue Exception => e perform(msg.merge!(retries: msg[:retries].to_i + 1)) unless msg[:retries].to_i >= 3 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activesearch-0.3.2 | lib/activesearch/algolia/worker.rb |