When collection
returns an ActiveRecord::Relation
, how do we set limit
for each "batch"? job-iteration
's Best Practices says it defaults to 100. 100 is way too small for expensive queries and/or large datasets.
It looks like that's passed in here.
But when using the maintenance_tasks
gem, in the collection
method, we're not explicitly building an enumerator. So how can we pass in or set the @batch_size
? I've tried some guesses like @batch_size
, @of
, def batch_size
, def of
inside the MaintenanceTasks::Task
.
This is considered a missing API in the gem and a PR is welcome.
https://github.com/Shopify/maintenance_tasks/issues/890
Update: this is now merged.