Skip to content

Instantly share code, notes, and snippets.

@sixty4bit
Created April 20, 2016 18:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sixty4bit/77bb52d7cc711de87166433fa5a6f885 to your computer and use it in GitHub Desktop.
Save sixty4bit/77bb52d7cc711de87166433fa5a6f885 to your computer and use it in GitHub Desktop.
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