mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-04-02 07:01:59 -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, :model
|
||||||
add_index :vehicles, :year
|
add_index :vehicles, :year
|
||||||
|
|
||||||
Vehicle.all.each do |v|
|
Vehicle.find_each.with_index do |vehicle, index|
|
||||||
VehicleVinDecodeJob.perform_later(v.id)
|
VehicleVinDecodeJob
|
||||||
|
.set(wait: (index / 50).minutes)
|
||||||
|
.perform_later(vehicle.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user