mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-10-03 17:10:43 -04:00
update vehicles in batches
This commit is contained in:
1 parent
0aef1d0c2b
commit
f9102c1a5d
1 file changed
+4
-2
@@ -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