diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-11-09 00:29:03 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-12-02 02:26:41 +0300 |
commit | 0e9efa74a7ea653a969436cb98c0a4ba80e8dd71 (patch) | |
tree | b44bbad59662d706eb47f24610efb541b633268c | |
parent | 7c43692f68dd62773b0a7b094453f582a4242ef7 (diff) |
Use `find` `-prune` option for performance
-rw-r--r-- | lib/gitlab/background_migration/prepare_unhashed_uploads.rb | 6 |
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 |