about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm23
-rw-r--r--script/public-inbox-extindex1
2 files changed, 13 insertions, 11 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 50342802..7aaf8291 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -284,16 +284,9 @@ sub last_commits {
 }
 
 sub _sync_inbox ($$$) {
-        my ($self, $opt, $ibx) = @_;
-        my $sync = {
-                need_checkpoint => \(my $bool = 0),
-                reindex => $opt->{reindex},
-                -opt => $opt,
-                self => $self,
-                ibx => $ibx,
-                nr => \(my $nr = 0),
-                -regen_fmt => "%u/?\n",
-        };
+        my ($self, $sync, $ibx) = @_;
+        $sync->{ibx} = $ibx;
+        $sync->{nr} = \(my $nr = 0);
         my $v = $ibx->version;
         my $ekey = $ibx->eidx_key;
         if ($v == 2) {
@@ -324,10 +317,18 @@ sub eidx_sync { # main entry point
         local $SIG{__WARN__} = sub {
                 $warn_cb->($self->{current_info}, ': ', @_);
         };
+        my $sync = {
+                need_checkpoint => \(my $need_checkpoint = 0),
+                reindex => $opt->{reindex},
+                -opt => $opt,
+                self => $self,
+                -regen_fmt => "%u/?\n",
+        };
+        local $SIG{USR1} = sub { $need_checkpoint = 1 };
 
         # don't use $_ here, it'll get clobbered by reindex_checkpoint
         for my $ibx (@{$self->{ibx_list}}) {
-                _sync_inbox($self, $opt, $ibx);
+                _sync_inbox($self, $sync, $ibx);
         }
 
         $self->{oidx}->rethread_done($opt);
diff --git a/script/public-inbox-extindex b/script/public-inbox-extindex
index bb1e174a..864a2732 100644
--- a/script/public-inbox-extindex
+++ b/script/public-inbox-extindex
@@ -33,6 +33,7 @@ die "--jobs must be >= 0\n" if defined $opt->{jobs} && $opt->{jobs} < 0;
 
 # require lazily to speed up --help
 my $eidx_dir = shift(@ARGV) // die "E: $help";
+local $SIG{USR1} = 'IGNORE'; # to be overridden in eidx_sync
 require PublicInbox::Admin;
 my $cfg = PublicInbox::Config->new;
 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);