diff options
author | Douwe Maan <douwe@gitlab.com> | 2019-06-24 12:31:46 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-06-24 12:31:46 +0300 |
commit | 7821defab33f917b62d1132339a521d609f191d6 (patch) | |
tree | 8fb9f71900430de597b7a4b56d0cf1a44f691d87 /db/post_migrate | |
parent | 833cb6e9f1506cf920c9bdf61cdb0095899ec778 (diff) | |
parent | 74a3e6b71254409d423077987f6961ea17ba00d9 (diff) |
Merge branch 'sync-merge-ref-upon-mergeability-check' into 'master'
Automatically update MR merge-ref along merge status
See merge request gitlab-org/gitlab-ce!29569
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20190620112608_enqueue_reset_merge_status_second_run.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/db/post_migrate/20190620112608_enqueue_reset_merge_status_second_run.rb b/db/post_migrate/20190620112608_enqueue_reset_merge_status_second_run.rb new file mode 100644 index 00000000000..2d096a2a39c --- /dev/null +++ b/db/post_migrate/20190620112608_enqueue_reset_merge_status_second_run.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class EnqueueResetMergeStatusSecondRun < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 10_000 + MIGRATION = 'ResetMergeStatus' + DELAY_INTERVAL = 5.minutes.to_i + + disable_ddl_transaction! + + def up + say 'Scheduling `ResetMergeStatus` jobs' + + # We currently have more than ~5_000_000 merge request records on GitLab.com. + # This means it'll schedule ~500 jobs (10k MRs each) with a 5 minutes gap, + # so this should take ~41 hours for all background migrations to complete. + # ((5_000_000 / 10_000) * 5) / 60 => 41.6666.. + queue_background_migration_jobs_by_range_at_intervals(MergeRequest, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + end +end |