diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-02-16 12:28:34 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-02-16 12:28:34 +0100 |
commit | dfef5437a26320fc4a55fc857b6e59d5e92c13c3 (patch) | |
tree | 55746dd4aae21d2eef3fb51028876f29fccd047b /db | |
parent | 2ee20d5a4b9923bbe1eef82e370da45d7efae287 (diff) | |
download | gitlab-ce-dfef5437a26320fc4a55fc857b6e59d5e92c13c3.tar.gz |
Use a helper to schedule pipeline stages migration
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20180212101928_schedule_build_stage_migration.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb index ad65a6fb16e..df15b2cd9d4 100644 --- a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb +++ b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb @@ -3,7 +3,7 @@ class ScheduleBuildStageMigration < ActiveRecord::Migration DOWNTIME = false MIGRATION = 'MigrateBuildStage'.freeze - BATCH_SIZE = 800 + BATCH_SIZE = 500 disable_ddl_transaction! @@ -15,10 +15,11 @@ class ScheduleBuildStageMigration < ActiveRecord::Migration def up disable_statement_timeout - Build.where('stage_id IS NULL').each_batch(of: BATCH_SIZE) do |builds, index| - builds.pluck('MIN(id)', 'MAX(id)').first.tap do |range| - BackgroundMigrationWorker.perform_in(index * 5.minutes, MIGRATION, range) - end + Build.where('stage_id IS NULL').tap do |relation| + queue_background_migration_jobs_by_range_at_intervals(relation, + MIGRATION, + 5.minutes, + batch_size: BATCH_SIZE) end end |