summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb b/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
index bfeb09f6da1..a73456af386 100644
--- a/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
+++ b/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
@@ -15,9 +15,10 @@ class MigrateStageIdReferenceInBackground < ActiveRecord::Migration
Build.where(stage_id: nil)
.find_in_batches(batch_size: BATCH_SIZE)
.with_index do |builds, batch|
- migrations = builds.map { |build| [MIGRATION, [build.id]] }
-
- BackgroundMigrationWorker.perform_bulk(*migrations)
+ builds.each do |build|
+ schedule = (batch - 1) * 5.minutes
+ BackgroundMigrationWorker.perform_at(schedule, MIGRATION, [build.id])
+ end
end
end