diff options
Diffstat (limited to 'app/workers/namespaces/root_statistics_worker.rb')
-rw-r--r-- | app/workers/namespaces/root_statistics_worker.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/workers/namespaces/root_statistics_worker.rb b/app/workers/namespaces/root_statistics_worker.rb index 02b3468c052..c8527182d35 100644 --- a/app/workers/namespaces/root_statistics_worker.rb +++ b/app/workers/namespaces/root_statistics_worker.rb @@ -16,15 +16,23 @@ module Namespaces def perform(namespace_id) namespace = Namespace.find(namespace_id) + if Feature.enabled?(:remove_aggregation_schedule_lease, namespace) + Namespaces::StatisticsRefresherService.new.execute(namespace) + else + refresh_through_namespace_aggregation_schedule(namespace) + end + + notify_storage_usage(namespace) + rescue ::Namespaces::StatisticsRefresherService::RefresherError, ActiveRecord::RecordNotFound => ex + Gitlab::ErrorTracking.track_exception(ex, namespace_id: namespace_id, namespace: namespace&.full_path) + end + + def refresh_through_namespace_aggregation_schedule(namespace) return unless namespace.aggregation_scheduled? Namespaces::StatisticsRefresherService.new.execute(namespace) namespace.aggregation_schedule.destroy - - notify_storage_usage(namespace) - rescue ::Namespaces::StatisticsRefresherService::RefresherError, ActiveRecord::RecordNotFound => ex - Gitlab::ErrorTracking.track_exception(ex, namespace_id: namespace_id, namespace: namespace&.full_path) end private |