Commit aef2c84d authored by Robert Speicher's avatar Robert Speicher

Merge branch 'extend-ci-minutes-reset-window' into 'master'

Spread CI minutes reset from 8 to 24 hours

See merge request gitlab-org/gitlab!51084
parents fb6a337a 3769859a
---
title: Spread monthly CI minutes reset from 8 to 24 hours
merge_request: 51084
author:
type: performance
...@@ -10,7 +10,7 @@ class ClearSharedRunnersMinutesWorker # rubocop:disable Scalability/IdempotentWo ...@@ -10,7 +10,7 @@ class ClearSharedRunnersMinutesWorker # rubocop:disable Scalability/IdempotentWo
feature_category :continuous_integration feature_category :continuous_integration
LEASE_TIMEOUT = 3600 LEASE_TIMEOUT = 3600
TIME_SPREAD = 8.hours.seconds.freeze TIME_SPREAD = 24.hours.seconds.freeze
BATCH_SIZE = 100_000 BATCH_SIZE = 100_000
def perform def perform
......
...@@ -146,13 +146,13 @@ RSpec.describe ClearSharedRunnersMinutesWorker do ...@@ -146,13 +146,13 @@ RSpec.describe ClearSharedRunnersMinutesWorker do
stub_const("#{described_class}::BATCH_SIZE", 3) stub_const("#{described_class}::BATCH_SIZE", 3)
end end
it 'runs a worker per batch' do it 'runs a worker per batch', :aggregate_failures do
# Spread evenly accross 8 hours (28800 seconds) # Spread evenly accross 24 hours (86,400 seconds)
expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(0.seconds, 2, 4) expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(0.seconds, 2, 4)
expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(7200.seconds, 5, 7) expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(21600.seconds, 5, 7)
expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(14400.seconds, 8, 10) expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(43200.seconds, 8, 10)
expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(21600.seconds, 11, 13) expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(64800.seconds, 11, 13)
expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(28800.seconds, 14, 16) expect(Ci::BatchResetMinutesWorker).to receive(:perform_in).with(86400.seconds, 14, 16)
subject subject
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