2019-04-01 06:11:08 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Worker for updating project statistics.
|
|
|
|
class UpdateProjectStatisticsWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
2019-10-18 11:11:44 +00:00
|
|
|
feature_category :source_code_management
|
|
|
|
|
2019-04-01 06:11:08 +00:00
|
|
|
# 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
|
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
|
|
|
def perform(project_id, statistics = [])
|
|
|
|
project = Project.find_by(id: project_id)
|
|
|
|
|
2019-04-05 13:07:09 +00:00
|
|
|
Projects::UpdateStatisticsService.new(project, nil, statistics: statistics).execute
|
2019-04-01 06:11:08 +00:00
|
|
|
end
|
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
|
|
|
end
|