Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-28 16:24:53 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-07 16:08:15 +0300
commit07693b43745e31e47466a9f1f5b73de894323a5d (patch)
tree07198303a879a4aa6cc077b8cf9cff2f79949856 /db
parent1dc20f7ac7dbb68464cb4ea2727fd4e7171cfba8 (diff)
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.rb7
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