diff options
author | James Lopez <james@jameslopez.es> | 2016-08-02 11:32:28 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-08-04 12:51:55 +0200 |
commit | 6a0bbb5aa58e37a0ad8c3817c4e809143adce1be (patch) | |
tree | 7ea74aad1858746674f1fa345cc5f40d32117b78 /app/services/import_export_clean_up_service.rb | |
parent | 632113e43cc3296759b11dc20b1b7f2f056278f0 (diff) | |
download | gitlab-ce-6a0bbb5aa58e37a0ad8c3817c4e809143adce1be.tar.gz |
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.rb | 24 |
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 |