Skip to content
Snippets Groups Projects
Commit 316d8821 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Perform stage_id ref backgound migration in bulks

parent 00ca7481
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment