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:
authorMichael Kozono <mkozono@gmail.com>2017-11-09 00:29:03 +0300
committerMichael Kozono <mkozono@gmail.com>2017-11-17 03:51:39 +0300
commitae531ad06a8a82542d9c140a0c4e5b2d8881af2e (patch)
treecdd47c348fbe4d9042e97c12889b6d8c97a22066
parentaa2c57e94f7f9fc5ffbb8d5001a571e4b64efce6 (diff)
Use `find` `-prune` option for performance
-rw-r--r--lib/gitlab/background_migration/prepare_unhashed_uploads.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/background_migration/prepare_unhashed_uploads.rb b/lib/gitlab/background_migration/prepare_unhashed_uploads.rb
index 982c0ff5320..ce488542df9 100644
--- a/lib/gitlab/background_migration/prepare_unhashed_uploads.rb
+++ b/lib/gitlab/background_migration/prepare_unhashed_uploads.rb
@@ -59,9 +59,11 @@ module Gitlab
end
def build_find_command(search_dir)
- cmd = ['find', search_dir, '-type', 'f', '!', '-path', "#{UPLOAD_DIR}/@hashed/*", '!', '-path', "#{UPLOAD_DIR}/tmp/*", '-print0']
+ hashed_path = "#{UPLOAD_DIR}/@hashed/*"
+ tmp_path = "#{UPLOAD_DIR}/tmp/*"
+ cmd = %W[find #{search_dir} -type f ! ( -path #{hashed_path} -prune ) ! ( -path #{tmp_path} -prune ) -print0]
- ['ionice', '-c', 'Idle'] + cmd if ionice_is_available?
+ %w[ionice -c Idle] + cmd if ionice_is_available?
cmd
end