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-08-23 15:48:26 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-23 15:48:26 +0300
commit3eba43b62dc825dd8a40f74fe027bb613b8ed2a8 (patch)
tree95a1eae0e6ce9bfd22f49ec3d7db27c582e8bce7 /db
parentd546f7d36e6703bda430e2f50fe4e87a07ab48f8 (diff)
Adjust a range and a size in stages statuses migration
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170711145558_migrate_stages_statuses.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/db/post_migrate/20170711145558_migrate_stages_statuses.rb b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
index 5a24fb1307f..7eb577ff3b2 100644
--- a/db/post_migrate/20170711145558_migrate_stages_statuses.rb
+++ b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
@@ -6,7 +6,7 @@ class MigrateStagesStatuses < ActiveRecord::Migration
disable_ddl_transaction!
BATCH_SIZE = 10000
- RANGE_SIZE = 1000
+ RANGE_SIZE = 500
MIGRATION = 'MigrateStageStatus'.freeze
class Stage < ActiveRecord::Base
@@ -17,10 +17,10 @@ class MigrateStagesStatuses < ActiveRecord::Migration
def up
Stage.where(status: nil).each_batch(of: BATCH_SIZE) do |relation, index|
relation.each_batch(of: RANGE_SIZE) do |batch|
- range = relation.pluck('MIN(id)', 'MAX(id)').first
- schedule = index * 5.minutes
+ range = batch.pluck('MIN(id)', 'MAX(id)').first
+ delay = index * 5.minutes
- BackgroundMigrationWorker.perform_in(schedule, MIGRATION, range)
+ BackgroundMigrationWorker.perform_in(delay, MIGRATION, range)
end
end
end