2021-04-17 20:07:23 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Analytics
|
|
|
|
module UsageTrends
|
|
|
|
class CountJobTriggerWorker
|
|
|
|
extend ::Gitlab::Utils::Override
|
|
|
|
include ApplicationWorker
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
sidekiq_options retry: 3
|
2021-04-17 20:07:23 +05:30
|
|
|
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
|
|
|
|
|
|
|
|
DEFAULT_DELAY = 3.minutes.freeze
|
|
|
|
|
|
|
|
feature_category :devops_reports
|
2021-06-08 01:23:25 +05:30
|
|
|
tags :exclude_from_kubernetes
|
2021-04-17 20:07:23 +05:30
|
|
|
urgency :low
|
|
|
|
|
|
|
|
idempotent!
|
|
|
|
|
|
|
|
def perform
|
|
|
|
recorded_at = Time.zone.now
|
|
|
|
|
|
|
|
worker_arguments = Gitlab::Analytics::UsageTrends::WorkersArgumentBuilder.new(
|
|
|
|
measurement_identifiers: ::Analytics::UsageTrends::Measurement.measurement_identifier_values,
|
|
|
|
recorded_at: recorded_at
|
|
|
|
).execute
|
|
|
|
|
|
|
|
perform_in = DEFAULT_DELAY.minutes.from_now
|
|
|
|
worker_arguments.each do |args|
|
|
|
|
CounterJobWorker.perform_in(perform_in, *args)
|
|
|
|
|
|
|
|
perform_in += DEFAULT_DELAY
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|