Skip to content
Snippets Groups Projects
Commit 0e9efa74 authored by Michael Kozono's avatar Michael Kozono
Browse files

Use `find` `-prune` option for performance

parent 7c43692f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment