diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-30 13:03:47 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-07 15:08:15 +0200 |
commit | 3408157155924e7bc817960767f69cc1fce9a5a5 (patch) | |
tree | 7a910a330d843decc46bdb48f3a82e2039a7f91d /db | |
parent | 84d9789d57edf1c09b8a63bbd4f455c9ee437aa7 (diff) | |
download | gitlab-ce-3408157155924e7bc817960767f69cc1fce9a5a5.tar.gz |
Do not override original AR5 batching interface
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb | 7 |
1 files changed, 5 insertions, 2 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 1d95fc62c87..30849ea1361 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 @@ -12,9 +12,12 @@ class MigrateStageIdReferenceInBackground < ActiveRecord::Migration end def up - Build.where(stage_id: nil).in_batches(of: BATCH_SIZE) do |relation, index| - schedule = index * 5.minutes + index = 1 + + Build.where(stage_id: nil).in_batches(of: BATCH_SIZE) do |relation| jobs = relation.pluck(:id).map { |id| [MIGRATION, [id]] } + schedule = index * 5.minutes + index += 1 BackgroundMigrationWorker.perform_bulk_in(schedule, jobs) end |