debian-mirror-gitlab/app/workers/update_project_statistics_worker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
677 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
# Worker for updating project statistics.
2020-04-08 14:13:33 +05:30
class UpdateProjectStatisticsWorker # rubocop:disable Scalability/IdempotentWorker
2019-07-31 22:56:46 +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-12-21 20:55:43 +05:30
feature_category :source_code_management
2019-07-31 22:56:46 +05:30
# project_id - The ID of the project for which to flush the cache.
# statistics - An Array containing columns from ProjectStatistics to
# refresh, if empty all columns will be refreshed
def perform(project_id, statistics = [])
2021-12-11 22:18:48 +05:30
project = Project.find_by_id(project_id)
2019-07-31 22:56:46 +05:30
Projects::UpdateStatisticsService.new(project, nil, statistics: statistics).execute
end
end