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