diff options
author | Eric Wong <e@80x24.org> | 2019-05-29 08:45:49 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-29 08:45:49 +0000 |
commit | 7187388231277606aaac3c00287f55ac7b604844 (patch) | |
tree | 107290b50139e745782619fe8127076dbf3792d0 /lib/PublicInbox/Admin.pm | |
parent | 5af59aa283a861292e1b79402af1c551e493e0f8 (diff) | |
parent | 5782c00d515df59933ec72ba53b6b243210d7c59 (diff) | |
download | public-inbox-7187388231277606aaac3c00287f55ac7b604844.tar.gz |
* v2-idx-progress: v2writable: show progress updates for index_sync index: support --verbose option v2writable: move index_sync options to sync state v2writable: use prototypes for internal subs v2writable: localize unindex-range.$EPOCH to $sync state v2writable: move {ranges} into $sync state v2writable: move {regen} into $sync state v2writable: move {reindex} field to $sync state v2writable: sync: move delete markers into $sync state v2writable: introduce $sync state and put mm_tmp in it
Diffstat (limited to 'lib/PublicInbox/Admin.pm')
-rw-r--r-- | lib/PublicInbox/Admin.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm index 34aa3129..07d8b572 100644 --- a/lib/PublicInbox/Admin.pm +++ b/lib/PublicInbox/Admin.pm @@ -167,4 +167,22 @@ sub index_inbox { } } +sub progress_prepare ($) { + my ($opt) = @_; + + # public-inbox-index defaults to quiet, -xcpdb and -compact do not + if (defined($opt->{quiet}) && $opt->{quiet} < 0) { + $opt->{quiet} = !$opt->{verbose}; + } + if ($opt->{quiet}) { + open my $null, '>', '/dev/null' or + die "failed to open /dev/null: $!\n"; + $opt->{1} = fileno($null); # suitable for spawn() redirect + $opt->{-dev_null} = $null; + } else { + $opt->{verbose} ||= 1; + $opt->{-progress} = sub { print STDERR @_ }; + } +} + 1; |