Class: UpdateProjectStatisticsWorker
- Inherits:
-
Object
- Object
- UpdateProjectStatisticsWorker
- Includes:
- ApplicationWorker
- Defined in:
- app/workers/update_project_statistics_worker.rb
Overview
Worker for updating project statistics.
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
-
#perform(lease_key, project_id, statistics = []) ⇒ Object
lease_key - The exclusive lease key to take project_id - The ID of the project for which to flush the cache.
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(lease_key, project_id, statistics = []) ⇒ Object
lease_key - The exclusive lease key to take 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
17 18 19 20 21 22 23 24 25 |
# File 'app/workers/update_project_statistics_worker.rb', line 17 def perform(lease_key, project_id, statistics = []) return unless Gitlab::ExclusiveLease .new(lease_key, timeout: ProjectCacheWorker::LEASE_TIMEOUT) .try_obtain project = Project.find_by_id(project_id) Projects::UpdateStatisticsService.new(project, nil, statistics: statistics).execute end |