Class: HashedStorage::ProjectMigrateWorker
- Inherits:
-
BaseWorker
- Object
- BaseWorker
- HashedStorage::ProjectMigrateWorker
- Includes:
- ApplicationWorker
- Defined in:
- app/workers/hashed_storage/project_migrate_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
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
Constants inherited from BaseWorker
BaseWorker::LEASE_KEY_SEGMENT, BaseWorker::LEASE_TIMEOUT
Instance Attribute Summary collapse
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
Instance Method Summary collapse
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_key, #lease_release?, #lease_taken_log_level, #lease_taken_message, #lease_timeout, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease
Instance Attribute Details
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
14 15 16 |
# File 'app/workers/hashed_storage/project_migrate_worker.rb', line 14 def project_id @project_id end |
Instance Method Details
#perform(project_id, old_disk_path = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/workers/hashed_storage/project_migrate_worker.rb', line 16 def perform(project_id, old_disk_path = nil) @project_id = project_id # we need to set this in order to create the lease_key try_obtain_lease do project = Project.without_deleted.find_by_id(project_id) break unless project && project.storage_upgradable? old_disk_path ||= Storage::LegacyProject.new(project).disk_path ::Projects::HashedStorage::MigrationService.new(project, old_disk_path, logger: logger).execute end end |