diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-02-02 16:59:43 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-02-28 22:58:15 +0300 |
commit | a7dae52e9d27adde427ef8aa066c0761071a3cd9 (patch) | |
tree | 8b6229e4e0afe7e71f9754089758cee8acd56cde /app/workers | |
parent | 45d2c31643017807cb3fc66c0be6e9cad9964faf (diff) |
Merge branch '4163-move-uploads-to-object-storage' into 'master'
Move uploads to object storage
Closes #4163
See merge request gitlab-org/gitlab-ee!3867
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/object_storage_upload_worker.rb | 16 | ||||
-rw-r--r-- | app/workers/upload_checksum_worker.rb | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/app/workers/object_storage_upload_worker.rb b/app/workers/object_storage_upload_worker.rb index 0b9411ff2df..e087261770f 100644 --- a/app/workers/object_storage_upload_worker.rb +++ b/app/workers/object_storage_upload_worker.rb @@ -8,16 +8,16 @@ class ObjectStorageUploadWorker 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.licensed? return unless uploader_class.background_upload_enabled? - subject = subject_class.find_by(id: subject_id) - return unless subject - - file = subject.public_send(file_field) # rubocop:disable GitlabSecurity/PublicSend - - return unless file.licensed? - - file.migrate!(uploader_class::REMOTE_STORE) + subject = subject_class.find(subject_id) + uploader = subject.public_send(file_field) # rubocop:disable GitlabSecurity/PublicSend + uploader.migrate!(ObjectStorage::Store::REMOTE) + rescue RecordNotFound + # does not retry when the record do not exists + Rails.logger.warn("Cannot find subject #{subject_class} with id=#{subject_id}.") end end diff --git a/app/workers/upload_checksum_worker.rb b/app/workers/upload_checksum_worker.rb index 9222760c031..65d40336f18 100644 --- a/app/workers/upload_checksum_worker.rb +++ b/app/workers/upload_checksum_worker.rb @@ -3,7 +3,7 @@ class UploadChecksumWorker def perform(upload_id) upload = Upload.find(upload_id) - upload.calculate_checksum + upload.calculate_checksum! upload.save! rescue ActiveRecord::RecordNotFound Rails.logger.error("UploadChecksumWorker: couldn't find upload #{upload_id}, skipping") |