Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/groups/update_statistics_worker.rb')
-rw-r--r--app/workers/groups/update_statistics_worker.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/workers/groups/update_statistics_worker.rb b/app/workers/groups/update_statistics_worker.rb
new file mode 100644
index 00000000000..40b9e883dbb
--- /dev/null
+++ b/app/workers/groups/update_statistics_worker.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+# Worker for updating group statistics.
+module Groups
+ class UpdateStatisticsWorker
+ include ApplicationWorker
+
+ data_consistency :always
+
+ sidekiq_options retry: 3
+
+ worker_resource_boundary :cpu
+
+ feature_category :source_code_management
+ idempotent!
+ loggable_arguments 0, 1
+
+ # group_id - The ID of the group for which to flush the cache.
+ # statistics - An Array containing columns from NamespaceStatistics to
+ # refresh, if empty all columns will be refreshed
+ def perform(group_id, statistics = [])
+ group = Group.find_by_id(group_id)
+
+ return unless group
+
+ Groups::UpdateStatisticsService.new(group, statistics: statistics).execute
+ end
+ end
+end