2019-09-30 21:07:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Namespaces
|
2020-04-22 19:07:51 +05:30
|
|
|
class RootStatisticsWorker
|
2019-09-30 21:07:59 +05:30
|
|
|
include ApplicationWorker
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
data_consistency :sticky
|
2021-10-27 15:23:28 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
queue_namespace :update_namespace_statistics
|
2019-12-21 20:55:43 +05:30
|
|
|
feature_category :source_code_management
|
2020-04-22 19:07:51 +05:30
|
|
|
idempotent!
|
2023-01-13 00:05:48 +05:30
|
|
|
deduplicate :until_executed, if_deduplicated: :reschedule_once
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
def perform(namespace_id)
|
|
|
|
namespace = Namespace.find(namespace_id)
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
return unless namespace.aggregation_scheduled?
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
Namespaces::StatisticsRefresherService.new.execute(namespace)
|
|
|
|
|
|
|
|
namespace.aggregation_schedule.destroy
|
2023-07-09 08:55:56 +05:30
|
|
|
|
|
|
|
notify_storage_usage(namespace)
|
|
|
|
rescue ::Namespaces::StatisticsRefresherService::RefresherError, ActiveRecord::RecordNotFound => ex
|
|
|
|
Gitlab::ErrorTracking.track_exception(ex, namespace_id: namespace_id, namespace: namespace&.full_path)
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def notify_storage_usage(namespace)
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
Namespaces::RootStatisticsWorker.prepend_mod_with('Namespaces::RootStatisticsWorker')
|