mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-04-01 22:51:58 -04:00
update vehicles in batches
This commit is contained in:
@@ -19,8 +19,10 @@ class AddPollingAndIndexes < ActiveRecord::Migration[7.0]
|
||||
add_index :vehicles, :model
|
||||
add_index :vehicles, :year
|
||||
|
||||
Vehicle.all.each do |v|
|
||||
VehicleVinDecodeJob.perform_later(v.id)
|
||||
Vehicle.find_each.with_index do |vehicle, index|
|
||||
VehicleVinDecodeJob
|
||||
.set(wait: (index / 50).minutes)
|
||||
.perform_later(vehicle.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user