summaryrefslogtreecommitdiff
path: root/app/workers/namespaces/prune_aggregation_schedules_worker.rb
blob: aeb5aa37a10965b33c4c152cc27f824a1c016ad1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Namespaces
  class PruneAggregationSchedulesWorker
    include ApplicationWorker
    include CronjobQueue # rubocop:disable Scalability/CronWorkerContext

    feature_category :source_code_management
    worker_resource_boundary :cpu

    # Worker to prune pending rows on Namespace::AggregationSchedule
    # It's scheduled to run once a day at 1:05am.
    def perform
      aggregation_schedules.find_each do |aggregation_schedule|
        aggregation_schedule.schedule_root_storage_statistics
      end
    end

    private

    def aggregation_schedules
      Namespace::AggregationSchedule.all
    end
  end
end