summaryrefslogtreecommitdiff
path: root/app/services/import_export_clean_up_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/import_export_clean_up_service.rb')
-rw-r--r--app/services/import_export_clean_up_service.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/services/import_export_clean_up_service.rb b/app/services/import_export_clean_up_service.rb
index 3ecb51b60d0..66ac7dac4ca 100644
--- a/app/services/import_export_clean_up_service.rb
+++ b/app/services/import_export_clean_up_service.rb
@@ -12,16 +12,20 @@ class ImportExportCleanUpService
def execute
Gitlab::Metrics.measure(:import_export_clean_up) do
- clean_up_export_object_files
-
- break unless File.directory?(path)
-
- clean_up_export_files
+ execute_cleanup
end
end
private
+ def execute_cleanup
+ clean_up_export_object_files
+ ensure
+ # We don't want a failure in cleaning up object storage from
+ # blocking us from cleaning up temporary storage.
+ clean_up_export_files if File.directory?(path)
+ end
+
def clean_up_export_files
Gitlab::Popen.popen(%W(find #{path} -not -path #{path} -mmin +#{mmin} -delete))
end