aboutsummaryrefslogtreecommitdiff
path: root/ag
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-02-23 14:44:14 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2015-02-23 14:44:14 -0800
commit45f28da0876f572b0bc5d81b7baeefda1b2b108f (patch)
treeb6507a93872967fb9f85a30706d96d278f53c055 /ag
parenthello linux (diff)
downloadbackend-45f28da0876f572b0bc5d81b7baeefda1b2b108f.tar.gz
backend-45f28da0876f572b0bc5d81b7baeefda1b2b108f.tar.bz2
backend-45f28da0876f572b0bc5d81b7baeefda1b2b108f.zip
Include a --jobs parameter.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'ag')
-rwxr-xr-xag7
1 files changed, 7 insertions, 0 deletions
diff --git a/ag b/ag
index d36acc4..97c223f 100755
--- a/ag
+++ b/ag
@@ -24,6 +24,7 @@ $options.index_only = false
$options.no_threading = false
$options.debug = false
$options.readonly = false
+$options.jobs = false
op = OptionParser.new do |opts|
opts.banner = "Usage: ag <<--index-full|--index-new|--delete|--reindex|--info> <--list listname>> <[--file|--msgid|--hash] <maildir/file/hash/messageid>> [options]"
@@ -93,6 +94,10 @@ op = OptionParser.new do |opts|
opts.on('--readonly', 'Do not alter the maildir in any way') do
$options.readonly = true
end
+
+ opts.on('--jobs', 'Number of parallel jobs to run (defaults to 75% of core count)') do |jobs|
+ $options.jobs = jobs
+ end
end
op.parse!
@@ -110,6 +115,8 @@ $maildir.serializer = Maildir::Serializer::Mail.new
$es = Elasticsearch::Client.new(log: false)
$es.transport.reload_connections!
+Ag::Utils.proc_count = $options.jobs
+
###############################################################################
def do_full