Commit f4b9ff9c authored by Michael Kozono's avatar Michael Kozono
Browse files

Use `find` `-prune` option for performance

parent f8b974c11ba3
......@@ -59,9 +59,11 @@ def each_file_path(search_dir, &block)
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?
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