Class: DetectRepositoryLanguagesWorker
- Inherits:
-
Object
- Object
- DetectRepositoryLanguagesWorker
- Includes:
- ApplicationWorker, ExceptionBacktrace, ExclusiveLeaseGuard
- Defined in:
- app/workers/detect_repository_languages_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary collapse
- LEASE_TIMEOUT =
300
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY
Constants included from WorkerAttributes
WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#perform(project_id, user_id = nil) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_release?, #log_error, #release_lease, #renew_lease!, #try_obtain_lease
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project
13 14 15 |
# File 'app/workers/detect_repository_languages_worker.rb', line 13 def project @project end |
Instance Method Details
#perform(project_id, user_id = nil) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
16 17 18 19 20 21 22 23 |
# File 'app/workers/detect_repository_languages_worker.rb', line 16 def perform(project_id, user_id = nil) @project = Project.find_by(id: project_id) return unless project try_obtain_lease do ::Projects::DetectRepositoryLanguagesService.new(project).execute end end |