Class: ObjectStorage::BackgroundMoveWorker
- Inherits:
-
Object
- Object
- ObjectStorage::BackgroundMoveWorker
- Includes:
- ApplicationWorker, ObjectStorageQueue
- Defined in:
- app/workers/object_storage/background_move_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 WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
- #build_uploader(subject, mount_point) ⇒ Object
- #perform(uploader_class_name, subject_class_name, file_field, subject_id) ⇒ Object
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#build_uploader(subject, mount_point) ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/workers/object_storage/background_move_worker.rb', line 27 def build_uploader(subject, mount_point) case subject when Upload then subject.retrieve_uploader(mount_point) else subject.send(mount_point) # rubocop:disable GitlabSecurity/PublicSend end end |
#perform(uploader_class_name, subject_class_name, file_field, subject_id) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/workers/object_storage/background_move_worker.rb', line 14 def perform(uploader_class_name, subject_class_name, file_field, subject_id) uploader_class = uploader_class_name.constantize subject_class = subject_class_name.constantize return unless uploader_class < ObjectStorage::Concern return unless uploader_class.object_store_enabled? return unless uploader_class.background_upload_enabled? subject = subject_class.find(subject_id) uploader = build_uploader(subject, file_field&.to_sym) uploader.migrate!(ObjectStorage::Store::REMOTE) end |