2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class UploadChecksumWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2017-02-22 14:25:06 -05:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :geo_replication
|
|
|
|
|
2017-02-22 14:25:06 -05:00
|
|
|
def perform(upload_id)
|
|
|
|
upload = Upload.find(upload_id)
|
2018-01-29 12:57:34 -05:00
|
|
|
upload.calculate_checksum!
|
2017-02-22 14:25:06 -05:00
|
|
|
upload.save!
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
2020-09-08 05:08:31 -04:00
|
|
|
Gitlab::AppLogger.error("UploadChecksumWorker: couldn't find upload #{upload_id}, skipping")
|
2017-02-22 14:25:06 -05:00
|
|
|
end
|
|
|
|
end
|