Commit d7584f32 authored by Micaël Bergeron's avatar Micaël Bergeron

ensure the cleanup is run if the upload fails

parent 7525a79f
......@@ -3,6 +3,7 @@ class PseudonymizerWorker
include CronjobQueue
def perform
abort "The pseudonymizer is not available with this license." unless License.feature_available?(:pseudonymizer)
return unless Gitlab::CurrentSettings.pseudonymizer_enabled?
options = Pseudonymizer::Options.new(
......@@ -11,10 +12,13 @@ class PseudonymizerWorker
)
dumper = Pseudonymizer::Dumper.new(options)
dumper.tables_to_csv
uploader = Pseudonymizer::Uploader.new(options, progress_output: File.open(File::NULL, "w"))
uploader.upload
uploader.cleanup
begin
dumper.tables_to_csv
uploader.upload
ensure
uploader.cleanup
end
end
end
......@@ -81,11 +81,14 @@ namespace :gitlab do
)
dumper = Pseudonymizer::Dumper.new(options)
dumper.tables_to_csv
uploader = Pseudonymizer::Uploader.new(options)
uploader.upload
uploader.cleanup
begin
dumper.tables_to_csv
uploader.upload
ensure
uploader.cleanup
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment