X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FXapcmd.pm;h=337978bd1a8799b79d10a315341333b06cf6ae3c;hb=2e59372029f89ae0e9c68384d6bda0ad50704730;hp=2864b0d4ec9ce5d10e0a745ed28479a63445d176;hpb=f5f7508636e5ecc4dcc2ecb18c6efc8c67e778f8;p=public-inbox.git diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm index 2864b0d4..337978bd 100644 --- a/lib/PublicInbox/Xapcmd.pm +++ b/lib/PublicInbox/Xapcmd.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2019 all contributors +# Copyright (C) 2018-2020 all contributors # License: AGPL-3.0+ package PublicInbox::Xapcmd; use strict; @@ -142,7 +142,11 @@ sub process_queue { while (scalar keys %pids) { my $pid = waitpid(-1, 0); my $args = delete $pids{$pid}; - die join(' ', @$args)." failed: $?\n" if $?; + if ($args) { + die join(' ', @$args)." failed: $?\n" if $?; + } else { + warn "unknown PID($pid) reaped: $?\n"; + } } } } @@ -217,13 +221,15 @@ sub prepare_run { ($tmp, \@queue); } +sub check_compact () { runnable_or_die($XAPIAN_COMPACT) } + sub run { my ($ibx, $task, $opt) = @_; # task = 'cpdb' or 'compact' my $cb = \&${\"PublicInbox::Xapcmd::$task"}; PublicInbox::Admin::progress_prepare($opt ||= {}); defined(my $dir = $ibx->{inboxdir}) or die "no inboxdir defined\n"; -d $dir or die "inboxdir=$dir does not exist\n"; - runnable_or_die($XAPIAN_COMPACT) if $opt->{compact}; + check_compact() if $opt->{compact}; my $reindex; # v1:{ from => $x40 }, v2:{ from => [ $x40, $x40, .. ] } } if (!$opt->{-coarse_lock}) {