Commit 24615363ac94bb2534236df40384596b47779f8b

Authored by Andrew Kane
1 parent 7dc20d4f

Updated readme [skip ci]

Showing 1 changed file with 2 additions and 0 deletions   Show diff stats
README.md
... ... @@ -1183,10 +1183,12 @@ Create a job to update the cache and reindex records with new conversions.
1183 1183 ```ruby
1184 1184 class ReindexConversionsJob < ActiveJob::Base
1185 1185 def perform(class_name)
  1186 + # get records that have a recent conversion
1186 1187 recently_converted_ids =
1187 1188 Searchjoy::Search.where("convertable_type = ? AND converted_at > ?", class_name, 1.day.ago)
1188 1189 .order(:convertable_id).uniq.pluck(:convertable_id)
1189 1190  
  1191 + # split into groups
1190 1192 recently_converted_ids.in_groups_of(1000, false) do |ids|
1191 1193 # fetch conversions and group by record
1192 1194 conversions_by_record = {}
... ...