Commit cfeb59e7 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Mark Namespaces::RootStatisticsWorker idempotent

This worker was already idempotent, this marks it as such so we can
deduplicate it later.
parent 574e17a7
......@@ -884,7 +884,7 @@
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent:
:idempotent: true
- :name: update_namespace_statistics:namespaces_schedule_aggregation
:feature_category: :source_code_management
:has_external_dependencies:
......
# frozen_string_literal: true
module Namespaces
class RootStatisticsWorker # rubocop:disable Scalability/IdempotentWorker
class RootStatisticsWorker
include ApplicationWorker
queue_namespace :update_namespace_statistics
feature_category :source_code_management
idempotent!
def perform(namespace_id)
namespace = Namespace.find(namespace_id)
......
......@@ -74,4 +74,19 @@ describe Namespaces::RootStatisticsWorker, '#perform' do
worker.perform(group.id)
end
end
it_behaves_like 'an idempotent worker' do
let(:job_args) { [group.id] }
it 'deletes one aggregation schedule' do
# Make sure the group and it's aggregation schedule are created before
# counting
group
expect { worker.perform(*job_args) }
.to change { Namespace::AggregationSchedule.count }.by(-1)
expect { worker.perform(*job_args) }
.not_to change { Namespace::AggregationSchedule.count }
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