Skip to content

Commit

Permalink
Fixes #4888 - Warning messages: `Scoped order is ignored, it's forced…
Browse files Browse the repository at this point in the history
… to be...
  • Loading branch information
rolfschmidt committed Oct 17, 2023
1 parent 27420f1 commit b7949ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/models/concerns/has_search_index_backend.rb
Expand Up @@ -182,9 +182,12 @@ def search_index_reload(silent: false, worker: 0)
query = reorder(created_at: :desc)
total = query.count
record_count = 0
offset = 0
batch_size = 200

query.in_batches(of: batch_size) do |records|
while query.offset(offset).limit(batch_size).count.positive?
records = query.offset(offset).limit(batch_size)

Parallel.map(records, { in_processes: worker }) do |record|
next if record.ignore_search_indexing?(:destroy)

Expand All @@ -198,6 +201,8 @@ def search_index_reload(silent: false, worker: 0)
end
end

offset += batch_size

next if silent

record_count += records.count
Expand Down

0 comments on commit b7949ad

Please sign in to comment.