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/lib
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-08-06 19:16:09 +0300
committerStan Hu <stanhu@gmail.com>2018-08-06 19:16:09 +0300
commit964d9f431f64754f171c5c523309417447c2ee71 (patch)
treed9d06c1ba2397ce9717a8ce0b01deb96d2bcce6b /lib
parentb4415c01740430cef58baf9bb0cbda2fb1055edb (diff)
parent1e5192cc8c2ebd3e0d740f3a044b7f5e4c086730 (diff)
Merge branch 'background-migrations-system-load' into 'master'
Respond to DB health in background migrations See merge request gitlab-org/gitlab-ce!20720
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/background_migration.rb6
-rw-r--r--lib/gitlab/database/migration_helpers.rb4
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/gitlab/background_migration.rb b/lib/gitlab/background_migration.rb
index d3f66877672..36c85dec544 100644
--- a/lib/gitlab/background_migration.rb
+++ b/lib/gitlab/background_migration.rb
@@ -46,7 +46,11 @@ module Gitlab
# arguments - The arguments to pass to the background migration's "perform"
# method.
def self.perform(class_name, arguments)
- const_get(class_name).new.perform(*arguments)
+ migration_class_for(class_name).new.perform(*arguments)
+ end
+
+ def self.migration_class_for(class_name)
+ const_get(class_name)
end
end
end
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index 4fe5b4cc835..f39b3b6eb5b 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -979,8 +979,8 @@ into similar problems in the future (e.g. when new tables are created).
# To not overload the worker too much we enforce a minimum interval both
# when scheduling and performing jobs.
- if delay_interval < BackgroundMigrationWorker::MIN_INTERVAL
- delay_interval = BackgroundMigrationWorker::MIN_INTERVAL
+ if delay_interval < BackgroundMigrationWorker.minimum_interval
+ delay_interval = BackgroundMigrationWorker.minimum_interval
end
model_class.each_batch(of: batch_size) do |relation, index|