Instantly share code, notes, and snippets.

Embed
What would you like to do?
cpu_available = 5
Order.includes(:products).find_in_batches do |batch|
batch.in_groups(cpu_available, false) do |group|
Process.fork do
Sunspot.index! group
end
end
Process.waitall
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment