about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-12 07:47:12 +0000
committerEric Wong <e@80x24.org>2021-09-12 07:48:56 +0000
commitb45a1dffa647f6427d0c900fcc55753db7a1994c (patch)
treeeafb5e666662bc65afd1aad33aeb203134b1efd7 /lib/PublicInbox/LEI.pm
parent02a0f3959b2e74f7217fcdca848822e7230acd6b (diff)
downloadpublic-inbox-b45a1dffa647f6427d0c900fcc55753db7a1994c.tar.gz
Setting up and maintaining git-only mirrors of v2 inboxes is
complex since multiple commands are required to clone and fetch
into epochs.

Unlike grokmirror, these commands do not require any
configuration.  Instead, they rely on existing git config files
and work like "git clone --mirror" and "git fetch",
respectively.

Like grokmirror, they use manifest.js.gz, but only on a
per-inbox basis so users won't have to clone every inbox of a
large instance nor edit config files to include/exclude inboxes
they're interested in.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index aff2bf19..6d5d3c03 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -468,6 +468,8 @@ sub x_it ($$) {
                 $self->{pkt_op_p}->pkt_do('x_it', $code);
         } elsif ($self->{sock}) { # to lei(1) client
                 send($self->{sock}, "x_it $code", MSG_EOR);
+        } elsif ($quit == \&CORE::exit) { # an admin command
+                exit($code >> 8);
         } # else ignore if client disconnected
 }
 
@@ -511,7 +513,7 @@ sub fail ($$;$) {
         my ($self, $buf, $exit_code) = @_;
         $self->{failed}++;
         err($self, $buf) if defined $buf;
-        # calls fail_handler:
+        # calls fail_handler
         $self->{pkt_op_p}->pkt_do('!') if $self->{pkt_op_p};
         x_it($self, ($exit_code // 1) << 8);
         undef;
@@ -536,6 +538,8 @@ sub child_error { # passes non-fatal curl exit codes to user
                 $self->{pkt_op_p}->pkt_do('child_error', $child_error);
         } elsif ($self->{sock}) { # to lei(1) client
                 send($self->{sock}, "child_error $child_error", MSG_EOR);
+        } else { # non-lei admin command
+                $self->{child_error} ||= $child_error;
         } # else noop if client disconnected
 }