diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-28 15:24:53 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-07 15:08:15 +0200 |
commit | 07693b43745e31e47466a9f1f5b73de894323a5d (patch) | |
tree | 07198303a879a4aa6cc077b8cf9cff2f79949856 /db | |
parent | 1dc20f7ac7dbb68464cb4ea2727fd4e7171cfba8 (diff) | |
download | gitlab-ce-07693b43745e31e47466a9f1f5b73de894323a5d.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 |