diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-28 15:24:53 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-28 15:24:53 +0200 |
commit | 187dd1005cd92c530146d7f5b0a89b368b09c3e9 (patch) | |
tree | 0495376a75e8c6b991d9fbc49e2cb17c095fd175 /db | |
parent | 5292eb651e1e3595e409a4c216eb0be3445a9319 (diff) | |
download | gitlab-ce-187dd1005cd92c530146d7f5b0a89b368b09c3e9.tar.gz |
Add specs for delayed stage_id background migrations
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb | 7 |
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 |