diff options
Diffstat (limited to 'script/public-inbox-watch')
-rwxr-xr-x | script/public-inbox-watch | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/script/public-inbox-watch b/script/public-inbox-watch index 4c50461f..9bcd42ed 100755 --- a/script/public-inbox-watch +++ b/script/public-inbox-watch @@ -11,13 +11,15 @@ use strict; use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); use IO::Handle; # ->autoflush use PublicInbox::Watch; +use PublicInbox::Import; +local $PublicInbox::Import::DROP_UNIQUE_UNSUB; use PublicInbox::Config; use PublicInbox::DS; my $do_scan = 1; GetOptions('scan!' => \$do_scan, # undocumented, testing only 'help|h' => \(my $show_help)) or do { print STDERR $help; exit 1 }; if ($show_help) { print $help; exit 0 }; -my $oldset = PublicInbox::DS::block_signals(); +PublicInbox::DS::block_signals(); STDOUT->autoflush(1); STDERR->autoflush(1); local $0 = $0; # local since this script may be eval-ed @@ -27,6 +29,7 @@ my $reload = sub { $watch->quit; $watch = PublicInbox::Watch->new(PublicInbox::Config->new); if ($watch) { + $watch->{sig} = $prev->{sig}; # prevent redundant signalfd warn "# reloaded\n"; } else { warn("E: reloading failed\n"); @@ -40,7 +43,7 @@ if ($watch) { warn "# scanning\n"; $watch->trigger_scan('full'); }; - my $quit = sub { + my $quit = sub { # may be called in IMAP/NNTP children $watch->quit if $watch; $watch = undef; $0 .= ' quitting'; @@ -51,8 +54,9 @@ if ($watch) { CHLD => \&PublicInbox::DS::enqueue_reap, }; $sig->{QUIT} = $sig->{TERM} = $sig->{INT} = $quit; + local @SIG{keys %$sig} = values(%$sig); # for non-signalfd/kqueue # --no-scan is only intended for testing atm, undocumented. PublicInbox::DS::requeue($scan) if $do_scan; - $watch->watch($sig, $oldset) while ($watch); + $watch->watch($sig) while ($watch); } |