2020-08-26 12:10:53 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PagesTransferWorker # rubocop:disable Scalability/IdempotentWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
2021-07-21 12:09:35 +00:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 18:10:09 +00:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2020-08-26 12:10:53 +00:00
|
|
|
TransferFailedError = Class.new(StandardError)
|
|
|
|
|
|
|
|
feature_category :pages
|
2021-05-03 09:10:02 +00:00
|
|
|
tags :exclude_from_kubernetes
|
2020-08-26 12:10:53 +00:00
|
|
|
loggable_arguments 0, 1
|
|
|
|
|
|
|
|
def perform(method, args)
|
2021-02-16 18:09:24 +00:00
|
|
|
return unless Gitlab::PagesTransfer::METHODS.include?(method)
|
2020-08-26 12:10:53 +00:00
|
|
|
|
|
|
|
result = Gitlab::PagesTransfer.new.public_send(method, *args) # rubocop:disable GitlabSecurity/PublicSend
|
|
|
|
|
|
|
|
# If result isn't truthy, the move failed. Promote this to an
|
|
|
|
# exception so that it will be logged and retried appropriately
|
|
|
|
raise TransferFailedError unless result
|
|
|
|
end
|
|
|
|
end
|