2019-07-02 10:44:39 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Namespaces
|
2020-03-23 11:09:36 -04:00
|
|
|
class RootStatisticsWorker
|
2019-07-02 10:44:39 -04:00
|
|
|
include ApplicationWorker
|
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2019-07-02 10:44:39 -04:00
|
|
|
queue_namespace :update_namespace_statistics
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :source_code_management
|
2020-03-23 11:09:36 -04:00
|
|
|
idempotent!
|
2019-07-02 10:44:39 -04:00
|
|
|
|
|
|
|
def perform(namespace_id)
|
|
|
|
namespace = Namespace.find(namespace_id)
|
|
|
|
|
2019-08-01 16:14:21 -04:00
|
|
|
return unless namespace.aggregation_scheduled?
|
2019-07-02 10:44:39 -04:00
|
|
|
|
|
|
|
Namespaces::StatisticsRefresherService.new.execute(namespace)
|
|
|
|
|
|
|
|
namespace.aggregation_schedule.destroy
|
2022-04-05 17:08:46 -04:00
|
|
|
|
|
|
|
notify_storage_usage(namespace)
|
2019-07-02 10:44:39 -04:00
|
|
|
rescue ::Namespaces::StatisticsRefresherService::RefresherError, ActiveRecord::RecordNotFound => ex
|
2020-03-09 17:07:57 -04:00
|
|
|
Gitlab::ErrorTracking.track_exception(ex, namespace_id: namespace_id, namespace: namespace&.full_path)
|
2019-07-02 10:44:39 -04:00
|
|
|
end
|
2022-04-05 17:08:46 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def notify_storage_usage(namespace)
|
|
|
|
end
|
2019-07-02 10:44:39 -04:00
|
|
|
end
|
|
|
|
end
|
2022-04-05 17:08:46 -04:00
|
|
|
|
|
|
|
Namespaces::RootStatisticsWorker.prepend_mod_with('Namespaces::RootStatisticsWorker')
|