Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
e87b32c34b4f
Commit
f4b9ff9c
authored
Nov 08, 2017
by
Michael Kozono
Browse files
Use `find` `-prune` option for performance
parent
f8b974c11ba3
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/gitlab/background_migration/prepare_unhashed_uploads.rb
View file @
e87b32c3
...
...
@@ -59,9 +59,11 @@ def each_file_path(search_dir, &block)
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment