Improve automatic post cleanup worker performances (#24785)
This commit is contained in:
parent
e92cd220f7
commit
ae68023dcb
@ -70,7 +70,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#get_budget' do
|
||||
describe '#compute_budget' do
|
||||
context 'on a single thread' do
|
||||
let(:process_set_stub) { [ { 'concurrency' => 1, 'queues' => ['push', 'default'] } ] }
|
||||
|
||||
@ -112,6 +112,19 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
|
||||
it 'eventually deletes every deletable toot' do
|
||||
expect { subject.perform; subject.perform; subject.perform; subject.perform }.to change { Status.count }.by(-20)
|
||||
end
|
||||
|
||||
context 'when given a big budget' do
|
||||
let(:process_set_stub) { [{ 'concurrency' => 400, 'queues' => %w(push default) }] }
|
||||
|
||||
before do
|
||||
stub_const 'Scheduler::AccountsStatusesCleanupScheduler::MAX_BUDGET', 400
|
||||
end
|
||||
|
||||
it 'correctly handles looping in a single run' do
|
||||
expect(subject.compute_budget).to eq(400)
|
||||
expect { subject.perform }.to change { Status.count }.by(-30)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user