diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-06-14 17:13:11 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-06-14 17:13:11 +0900 |
commit | a59ae2909067f848c45fcc25e19f92184e0ee33d (patch) | |
tree | b66085219efe9e0d6cb1a944bfa2e96757940a8c | |
parent | 1d04023e6506d68dabe53f339f8252203d0828b3 (diff) | |
parent | e38720a50695ec5746593bad431992aa5ff42e4a (diff) | |
download | gitlab-ce-improve-queue-background-migration.tar.gz |
Merge branch 'improve-queue-background-migration' of gitlab.com:gitlab-org/gitlab-ce into improve-queue-background-migrationimprove-queue-background-migration
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 0bd0aa14b92..37fc8deded7 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -897,7 +897,7 @@ into similar problems in the future (e.g. when new tables are created). delay_interval = BackgroundMigrationWorker::MIN_INTERVAL end - interval = 0 + interval_index = 1 jobs = [] model_class.unscoped.each_batch(of: range_size) do |outer_relation| @@ -911,7 +911,8 @@ into similar problems in the future (e.g. when new tables are created). # That way we make background migration code to be predictable. It is possible that we will # push a number of concurrent small background migration jobs to be executed at the same time. # At most we will push 2xbatch_size-1, but in normal circumstances it will be 1.5*batch_size - BackgroundMigrationWorker.build_perfom_in(delay_interval * ++interval, jobs) + BackgroundMigrationWorker.bulk_perform_in(delay_interval * interval_index, jobs) + interval_index += 1 jobs.clear end @@ -919,7 +920,7 @@ into similar problems in the future (e.g. when new tables are created). end end - BackgroundMigrationWorker.build_perfom_in(delay_interval * ++interval, jobs) unless jobs.empty? + BackgroundMigrationWorker.bulk_perform_in(delay_interval * interval_index, jobs) unless jobs.empty? end # Fetches indexes on a column by name for postgres. |