diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-29 12:14:54 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-29 12:14:54 +0200 |
commit | 8bd9cb6c87a1a1c51830360fe1aa1a228f9c768e (patch) | |
tree | 6396161a1014ebc242f3019d7a9a7979a82a1874 /db | |
parent | 0c14b6f0985415bd9762886378b0ad5a009d80cd (diff) | |
download | gitlab-ce-8bd9cb6c87a1a1c51830360fe1aa1a228f9c768e.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.rb | 6 |
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 |