summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-02-22 14:25:06 -0500
committerRobert Speicher <rspeicher@gmail.com>2017-03-06 14:41:09 -0500
commit4c622b71fd284058deee483bf0009f8179b792bc (patch)
tree306cc2ffb5eec2d4fc972b33d14be2baf3959718 /app/workers
parent2a2b24d5a7687abf7e7517eb011ba427852d6df0 (diff)
downloadgitlab-ce-4c622b71fd284058deee483bf0009f8179b792bc.tar.gz
Add Upload model and UploadChecksumWorker worker
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/upload_checksum_worker.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/workers/upload_checksum_worker.rb b/app/workers/upload_checksum_worker.rb
new file mode 100644
index 00000000000..78931f1258f
--- /dev/null
+++ b/app/workers/upload_checksum_worker.rb
@@ -0,0 +1,12 @@
+class UploadChecksumWorker
+ include Sidekiq::Worker
+ include DedicatedSidekiqQueue
+
+ def perform(upload_id)
+ upload = Upload.find(upload_id)
+ upload.calculate_checksum
+ upload.save!
+ rescue ActiveRecord::RecordNotFound
+ Rails.logger.error("UploadChecksumWorker: couldn't find upload #{upload_id}, skipping")
+ end
+end