]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Xapcmd.pm
doc: add technical/whyperl
[public-inbox.git] / lib / PublicInbox / Xapcmd.pm
index 2864b0d4ec9ce5d10e0a745ed28479a63445d176..8e2b9063c7443e3f0b8916560e22f054789dc71b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 package PublicInbox::Xapcmd;
 use strict;
@@ -217,13 +217,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}) {