Adjust batch size for migrating runners token
This commit is contained in:
parent
1143411ae8
commit
3dfbfa4e4f
|
@ -5,7 +5,7 @@ class ScheduleRunnersTokenEncryption < ActiveRecord::Migration
|
|||
|
||||
DOWNTIME = false
|
||||
BATCH_SIZE = 10000
|
||||
RANGE_SIZE = 100
|
||||
RANGE_SIZE = 2000
|
||||
MIGRATION = 'EncryptRunnersTokens'
|
||||
|
||||
MODELS = [
|
||||
|
@ -20,7 +20,7 @@ class ScheduleRunnersTokenEncryption < ActiveRecord::Migration
|
|||
def up
|
||||
MODELS.each do |model|
|
||||
model.each_batch(of: BATCH_SIZE) do |relation, index|
|
||||
delay = index * 2.minutes
|
||||
delay = index * 4.minutes
|
||||
|
||||
relation.each_batch(of: RANGE_SIZE) do |relation|
|
||||
range = relation.pluck('MIN(id)', 'MAX(id)').first
|
||||
|
|
|
@ -24,13 +24,13 @@ describe ScheduleRunnersTokenEncryption, :migration do
|
|||
Timecop.freeze do
|
||||
migrate!
|
||||
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(2.minutes, 'settings', 1, 1)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(2.minutes, 'namespace', 11, 11)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 'namespace', 12, 12)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(2.minutes, 'project', 111, 111)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 'project', 114, 114)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(2.minutes, 'runner', 201, 201)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 'runner', 202, 202)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 'settings', 1, 1)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 'namespace', 11, 11)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(8.minutes, 'namespace', 12, 12)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 'project', 111, 111)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(8.minutes, 'project', 114, 114)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(4.minutes, 'runner', 201, 201)
|
||||
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(8.minutes, 'runner', 202, 202)
|
||||
expect(BackgroundMigrationWorker.jobs.size).to eq 7
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue