Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-08-02 12:32:28 +0300
committerJames Lopez <james@jameslopez.es>2016-08-04 13:51:55 +0300
commit6a0bbb5aa58e37a0ad8c3817c4e809143adce1be (patch)
tree7ea74aad1858746674f1fa345cc5f40d32117b78 /app/services/import_export_clean_up_service.rb
parent632113e43cc3296759b11dc20b1b7f2f056278f0 (diff)
using shared path for project import uploads and refactored gitlab remove export worker
Diffstat (limited to 'app/services/import_export_clean_up_service.rb')
-rw-r--r--app/services/import_export_clean_up_service.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/services/import_export_clean_up_service.rb b/app/services/import_export_clean_up_service.rb
new file mode 100644
index 00000000000..6442406d77e
--- /dev/null
+++ b/app/services/import_export_clean_up_service.rb
@@ -0,0 +1,24 @@
+class ImportExportCleanUpService
+ LAST_MODIFIED_TIME_IN_MINUTES = 1440
+
+ attr_reader :mmin, :path
+
+ def initialize(mmin = LAST_MODIFIED_TIME_IN_MINUTES)
+ @mmin = mmin
+ @path = Gitlab::ImportExport.storage_path
+ end
+
+ def execute
+ Gitlab::Metrics.measure(:import_export_clean_up) do
+ return unless File.directory?(path)
+
+ clean_up_export_files
+ end
+ end
+
+ private
+
+ def clean_up_export_files
+ Gitlab::Popen.popen(%W(find #{path} -not -path #{path} -mmin +#{mmin} -delete))
+ end
+end