]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei_xsearch: allow signals during long queries
authorEric Wong <e@80x24.org>
Tue, 20 Aug 2024 10:35:21 +0000 (10:35 +0000)
committerEric Wong <e@80x24.org>
Wed, 21 Aug 2024 18:16:26 +0000 (18:16 +0000)
Xapian ->mset, remote Xapian calls via remote inboxes, and
lcat dumps can take a long time via wq_io_do and hold
lei_xsearch processes open for too long after a client
disconnects prematurely.

This fixes wait_for_eof shutdown timeouts on the lei-daemon quit
pipe when running t/lei-sigpipe.t with GIANT_INBOX_DIR pointed
to a meta@public-inbox.org mirror on my old laptop.

lib/PublicInbox/LeiXSearch.pm

index 43dedd106af22cf5a3a92f5925da450525d23b7e..e20b13c6b86c260392e506ca1ea10c5f94b6c857 100644 (file)
@@ -150,6 +150,7 @@ sub mset_progress {
 sub query_one_mset { # for --threads and l2m w/o sort
        my ($self, $ibxish) = @_;
        my $lei = $self->{lei};
+       my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
        my ($srch, $over) = ($ibxish->search, $ibxish->over);
        my $dir = $ibxish->{inboxdir} // $ibxish->{topdir};
        return warn("$dir not indexed by Xapian\n") unless ($srch && $over);
@@ -223,6 +224,7 @@ sub query_one_mset { # for --threads and l2m w/o sort
 sub query_combined_mset { # non-parallel for non-"--threads" users
        my ($self) = @_;
        my $lei = $self->{lei};
+       my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
        my $mo = { %{$lei->{mset_opt}} };
        local $0 = "$0 C $mo->{qstr}";
        my $mset;
@@ -317,6 +319,7 @@ sub fudge_qstr_time ($$$) {
 sub query_remote_mboxrd {
        my ($self, $uris) = @_;
        local $SIG{TERM} = sub { exit(0) }; # for DESTROY (File::Temp, $reap)
+       my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
        my $lei = $self->{lei};
        my $opt = $lei->{opt};
        my $qstr = $lei->{mset_opt}->{qstr};
@@ -633,6 +636,7 @@ sub _lcat2smsg { # git->cat_async callback
 sub lcat_dump { # via wq_io_do
        my ($self) = @_;
        my $lei = $self->{lei};
+       my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
        my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
        my $git = $lei->{ale}->git;
        if (!$lei->{l2m}) {