2018-10-07 18:31:08 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
class DeleteStoredFilesWorker # rubocop:disable Scalability/IdempotentWorker
|
2018-10-07 18:31:08 +00:00
|
|
|
include ApplicationWorker
|
|
|
|
|
2019-10-18 11:11:44 +00:00
|
|
|
feature_category_not_owned!
|
2020-06-12 12:08:56 +00:00
|
|
|
loggable_arguments 0
|
2019-10-18 11:11:44 +00:00
|
|
|
|
2018-10-07 18:31:08 +00:00
|
|
|
def perform(class_name, keys)
|
|
|
|
klass = begin
|
|
|
|
class_name.constantize
|
2020-09-02 12:10:35 +00:00
|
|
|
rescue NameError
|
|
|
|
nil
|
2018-10-07 18:31:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
unless klass
|
|
|
|
message = "Unknown class '#{class_name}'"
|
|
|
|
logger.error(message)
|
2019-12-16 12:07:43 +00:00
|
|
|
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(RuntimeError.new(message))
|
2018-10-07 18:31:08 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
klass.new(logger: logger).delete_keys(keys)
|
|
|
|
end
|
|
|
|
end
|