debian-mirror-gitlab/app/workers/namespaces/root_statistics_worker.rb

28 lines
757 B
Ruby
Raw Normal View History

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
2021-10-27 15:23:28 +05:30
data_consistency :always
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!
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
rescue ::Namespaces::StatisticsRefresherService::RefresherError, ActiveRecord::RecordNotFound => ex
2020-04-08 14:13:33 +05:30
Gitlab::ErrorTracking.track_exception(ex, namespace_id: namespace_id, namespace: namespace&.full_path)
2019-09-30 21:07:59 +05:30
end
end
end