* [PATCH 0/4] extindex: more fixes and usability things
@ 2020-12-26 10:16 7% Eric Wong
2020-12-26 10:16 6% ` [PATCH 1/4] extindex: various --watch signal handling fixes Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-12-26 10:16 UTC (permalink / raw)
To: meta
--watch seems nice, and "--watch --all" (or just "--all")
without having to specify the pathname of the extindex
is nice, too.
It still needs to write extindex.all.topdir if none is
configured and a section 1 manpage...
Eric Wong (4):
extindex: various --watch signal handling fixes
extindex: enable autoflush on STDOUT/STDERR
extindex: add undocumented --no-scan switch
extindex: allow using --all without EXTINDEX_DIR
lib/PublicInbox/ExtSearchIdx.pm | 18 ++++++++++++++----
script/public-inbox-extindex | 21 +++++++++++++++------
2 files changed, 29 insertions(+), 10 deletions(-)
^ permalink raw reply [relevance 7%]
* [PATCH 1/4] extindex: various --watch signal handling fixes
2020-12-26 10:16 7% [PATCH 0/4] extindex: more fixes and usability things Eric Wong
@ 2020-12-26 10:16 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-12-26 10:16 UTC (permalink / raw)
To: meta
We need to clobber the SIGUSR1 resync queue on SIGHUP to
invalidate old inbox objects. Furthermore, the lengthy
initial scan needs to ignore signals intended for the
event loop to avoid unexpected behavior. Finally, add
some progress output to inform users on the terminal
to inform users' of progress.
---
lib/PublicInbox/ExtSearchIdx.pm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 53ff2ca1..778154a5 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -1008,6 +1008,7 @@ sub eidx_reload { # -extindex --watch SIGHUP handler
if ($self->{cfg}) {
my $pr = $self->{-watch_sync}->{-opt}->{-progress};
$pr->('reloading ...') if $pr;
+ delete $self->{-resync_queue};
@{$self->{ibx_list}} = ();
%{$self->{ibx_map}} = ();
delete $self->{-watch_sync}->{id2pos};
@@ -1043,6 +1044,10 @@ sub event_step { # PublicInbox::DS::requeue callback
sub eidx_watch { # public-inbox-extindex --watch main loop
my ($self, $opt) = @_;
+ local %SIG = %SIG;
+ for my $sig (qw(HUP USR1 TSTP QUIT INT TERM)) {
+ $SIG{$sig} = sub { warn "SIG$sig ignored while scanning\n" };
+ }
require PublicInbox::InboxIdle;
require PublicInbox::DS;
require PublicInbox::Syscall;
@@ -1052,6 +1057,8 @@ sub eidx_watch { # public-inbox-extindex --watch main loop
$idler->watch_inbox($_) for @{$self->{ibx_list}};
}
$_->subscribe_unlock(__PACKAGE__, $self) for @{$self->{ibx_list}};
+ my $pr = $opt->{-progress};
+ $pr->("performing initial scan ...\n") if $pr;
my $sync = eidx_sync($self, $opt); # initial sync
return if $sync->{quit};
my $oldset = PublicInbox::Sigfd::block_signals();
@@ -1067,7 +1074,7 @@ sub eidx_watch { # public-inbox-extindex --watch main loop
$sig->{QUIT} = $sig->{INT} = $sig->{TERM} = $quit;
my $sigfd = PublicInbox::Sigfd->new($sig,
$PublicInbox::Syscall::SFD_NONBLOCK);
- local %SIG = (%SIG, %$sig) if !$sigfd;
+ %SIG = (%SIG, %$sig) if !$sigfd;
local $self->{-watch_sync} = $sync; # for ->on_inbox_unlock
if (!$sigfd) {
# wake up every second to accept signals if we don't
@@ -1076,6 +1083,7 @@ sub eidx_watch { # public-inbox-extindex --watch main loop
PublicInbox::DS->SetLoopTimeout(1000);
}
PublicInbox::DS->SetPostLoopCallback(sub { !$sync->{quit} });
+ $pr->("initial scan complete, entering event loop\n") if $pr;
PublicInbox::DS->EventLoop; # calls InboxIdle->event_step
done($self);
}
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-12-26 10:16 7% [PATCH 0/4] extindex: more fixes and usability things Eric Wong
2020-12-26 10:16 6% ` [PATCH 1/4] extindex: various --watch signal handling fixes Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).