diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-24 21:18:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-24 21:18:05 +0000 |
commit | 3d911c6c1f34df47036f1d7e0838e4d5876ee923 (patch) | |
tree | 492dfc9e4a3d3ea6d4749f35a78abafe634889f6 /app/workers | |
parent | 0bf82aa5cb3b1ed826dd5c0d46331e17aa60d9e9 (diff) | |
download | gitlab-ce-3d911c6c1f34df47036f1d7e0838e4d5876ee923.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/namespaces/root_statistics_worker.rb | 16 | ||||
-rw-r--r-- | app/workers/namespaces/schedule_aggregation_worker.rb | 16 |
2 files changed, 8 insertions, 24 deletions
diff --git a/app/workers/namespaces/root_statistics_worker.rb b/app/workers/namespaces/root_statistics_worker.rb index c8527182d35..02b3468c052 100644 --- a/app/workers/namespaces/root_statistics_worker.rb +++ b/app/workers/namespaces/root_statistics_worker.rb @@ -16,23 +16,15 @@ 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 diff --git a/app/workers/namespaces/schedule_aggregation_worker.rb b/app/workers/namespaces/schedule_aggregation_worker.rb index bf48eb8180e..7cd7f5223d6 100644 --- a/app/workers/namespaces/schedule_aggregation_worker.rb +++ b/app/workers/namespaces/schedule_aggregation_worker.rb @@ -13,24 +13,16 @@ module Namespaces idempotent! def perform(namespace_id) + return unless aggregation_schedules_table_exists? + namespace = Namespace.find(namespace_id) root_ancestor = namespace.root_ancestor - if Feature.enabled?(:remove_aggregation_schedule_lease, root_ancestor) - Namespaces::RootStatisticsWorker.perform_async(root_ancestor.id) - else - schedule_through_aggregation_schedules_table(root_ancestor) - end - rescue ActiveRecord::RecordNotFound => ex - Gitlab::ErrorTracking.track_exception(ex, namespace_id: namespace_id) - end - - def schedule_through_aggregation_schedules_table(root_ancestor) - return unless aggregation_schedules_table_exists? - return if root_ancestor.aggregation_scheduled? Namespace::AggregationSchedule.safe_find_or_create_by!(namespace_id: root_ancestor.id) + rescue ActiveRecord::RecordNotFound => ex + Gitlab::ErrorTracking.track_exception(ex, namespace_id: namespace_id) end private |