+ my $quit = sub {
+ $watch->quit if $watch;
+ $watch = undef;
+ $0 .= ' quitting';
+ };
+ my $sig = {
+ HUP => $reload,
+ USR1 => $scan,
+ CHLD => \&PublicInbox::DS::enqueue_reap,
+ };
+ $sig->{QUIT} = $sig->{TERM} = $sig->{INT} = $quit;
+
+ # --no-scan is only intended for testing atm, undocumented.
+ PublicInbox::DS::requeue($scan) if $do_scan;
+ $watch->watch($sig, $oldset) while ($watch);