Commit 6e23fc3e authored by Sean Arnold's avatar Sean Arnold Committed by Douglas Barbosa Alexandre

Enqueue all issues, at 50k batches

parent 4c8135b0
......@@ -3,7 +3,7 @@
class BackfillIncidentIssueEscalationStatuses < Gitlab::Database::Migration[1.0]
MIGRATION = 'BackfillIncidentIssueEscalationStatuses'
DELAY_INTERVAL = 2.minutes
BATCH_SIZE = 1_000
BATCH_SIZE = 50_000
disable_ddl_transaction!
......@@ -11,12 +11,10 @@ class BackfillIncidentIssueEscalationStatuses < Gitlab::Database::Migration[1.0]
include EachBatch
self.table_name = 'issues'
scope :incidents, -> { where(issue_type: 1) }
end
def up
relation = Issue.incidents
relation = Issue.all
queue_background_migration_jobs_by_range_at_intervals(
relation, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE, track_jobs: true)
......
......@@ -15,7 +15,7 @@ RSpec.describe BackfillIncidentIssueEscalationStatuses do
end
it 'schedules jobs for incident issues' do
issues.create!(project_id: project.id) # non-incident issue
issue_1 = issues.create!(project_id: project.id) # non-incident issue
incident_1 = issues.create!(project_id: project.id, issue_type: 1)
incident_2 = issues.create!(project_id: project.id, issue_type: 1)
......@@ -24,10 +24,12 @@ RSpec.describe BackfillIncidentIssueEscalationStatuses do
migrate!
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(
2.minutes, incident_1.id, incident_1.id)
2.minutes, issue_1.id, issue_1.id)
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(
4.minutes, incident_2.id, incident_2.id)
expect(BackgroundMigrationWorker.jobs.size).to eq(2)
4.minutes, incident_1.id, incident_1.id)
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(
6.minutes, incident_2.id, incident_2.id)
expect(BackgroundMigrationWorker.jobs.size).to eq(3)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment