BigW Consortium Gitlab

Commit 8bd9cb6c by Grzegorz Bizon

Perform stage_id ref backgound migration in bulks

parent 0c14b6f0
......@@ -15,9 +15,9 @@ class MigrateStageIdReferenceInBackground < ActiveRecord::Migration
Build.where(stage_id: nil)
.in_batches(of: BATCH_SIZE) do |relation, index|
schedule = index * 5.minutes
relation.each do |build|
BackgroundMigrationWorker.perform_at(schedule, MIGRATION, [build.id])
end
jobs = relation.pluck(:id).map { |id| [MIGRATION, [id]] }
BackgroundMigrationWorker.perform_bulk_in(schedule, jobs)
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment