Commit bd4a01c9 authored by Max Woolf's avatar Max Woolf

Remove spacing interval between soft deleted projects

Fixes an issue whereby on a day where
there are more than a small number of
projects waiting for deletion, they could
be scheduled for deletion weeks or months
in the future.
parent fed9026b
...@@ -4,7 +4,7 @@ class AdjournedProjectsDeletionCronWorker # rubocop:disable Scalability/Idempote ...@@ -4,7 +4,7 @@ class AdjournedProjectsDeletionCronWorker # rubocop:disable Scalability/Idempote
include ApplicationWorker include ApplicationWorker
include CronjobQueue include CronjobQueue
INTERVAL = 5.minutes.to_i INTERVAL = 10.seconds.to_i
feature_category :authentication_and_authorization feature_category :authentication_and_authorization
......
---
title: Remove spacing interval between soft deleted projects
merge_request: 35046
author:
type: fixed
...@@ -6,8 +6,8 @@ RSpec.describe AdjournedProjectsDeletionCronWorker do ...@@ -6,8 +6,8 @@ RSpec.describe AdjournedProjectsDeletionCronWorker do
describe "#perform" do describe "#perform" do
subject(:worker) { described_class.new } subject(:worker) { described_class.new }
let(:user) { create(:user)} let_it_be(:user) { create(:user)}
let(:marked_for_deletion_at) { 14.days.ago } let_it_be(:marked_for_deletion_at) { 14.days.ago }
let!(:project_marked_for_deletion) { create(:project, marked_for_deletion_at: marked_for_deletion_at, deleting_user: user) } let!(:project_marked_for_deletion) { create(:project, marked_for_deletion_at: marked_for_deletion_at, deleting_user: user) }
before do before do
...@@ -21,6 +21,17 @@ RSpec.describe AdjournedProjectsDeletionCronWorker do ...@@ -21,6 +21,17 @@ RSpec.describe AdjournedProjectsDeletionCronWorker do
worker.perform worker.perform
end end
context 'when two projects are scheduled for deletion' do
let_it_be(:project_marked_for_deletion_two) { create(:project, marked_for_deletion_at: marked_for_deletion_at, deleting_user: user) }
it 'schedules the second job 10 seconds after the first' do
expect(AdjournedProjectDeletionWorker).to receive(:perform_in).with(10, project_marked_for_deletion.id)
expect(AdjournedProjectDeletionWorker).to receive(:perform_in).with(0, project_marked_for_deletion_two.id)
worker.perform
end
end
context 'marked for deletion exectly before number of days from settings' do context 'marked for deletion exectly before number of days from settings' do
let(:marked_for_deletion_at) { 7.days.ago } let(:marked_for_deletion_at) { 7.days.ago }
......
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