Commit 0e9efa74 authored by Michael Kozono's avatar Michael Kozono

Use `find` `-prune` option for performance

parent 7c43692f
...@@ -59,9 +59,11 @@ module Gitlab ...@@ -59,9 +59,11 @@ module Gitlab
end end
def build_find_command(search_dir) 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 cmd
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment