summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-29 12:14:54 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-07 15:08:15 +0200
commit316d8821cdcf048d08478b255060cf7645e33049 (patch)
tree892794e5f8d8cc694398ff715b535acc75b2299d /db
parent00ca74810814a9f35a14755f1b91169096640dba (diff)
downloadgitlab-ce-316d8821cdcf048d08478b255060cf7645e33049.tar.gz
Perform stage_id ref backgound migration in bulks
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb6
1 files changed, 3 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 9e95216b35a..c54e8bde095 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,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