about summary refs log tree commit homepage
path: root/script/public-inbox-watch
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-27 10:03:39 +0000
committerEric Wong <e@yhbt.net>2020-06-28 22:27:16 +0000
commitfac2f5b63f0595b67a99784c8a9f9801c1fc9f09 (patch)
treebb225dd4903a7078dbe1f4a271a2d59cc167777c /script/public-inbox-watch
parent94096cab6cd5e00c8a36a4a2667bdb9acf43d01f (diff)
downloadpublic-inbox-fac2f5b63f0595b67a99784c8a9f9801c1fc9f09.tar.gz
We can avoid synchronous `waitpid(-1, 0)' and save a process
when simultaneously watching Maildirs.

One DS bug is fixed: ->Reset needs to clear the DS $in_loop flag
in forked children so dwaitpid() fails and allows git processes
to be reaped synchronously.  TestCommon also calls DS->Reset
when spawning new processes, since t/imapd.t uses DS->EventLoop
while waiting on -watch to write.
Diffstat (limited to 'script/public-inbox-watch')
-rwxr-xr-xscript/public-inbox-watch6
1 files changed, 5 insertions, 1 deletions
diff --git a/script/public-inbox-watch b/script/public-inbox-watch
index b6d545ad..ae7b70be 100755
--- a/script/public-inbox-watch
+++ b/script/public-inbox-watch
@@ -22,7 +22,11 @@ if ($watch_md) {
                 $watch_md->quit if $watch_md;
                 $watch_md = undef;
         };
-        my $sig = { HUP => $reload, USR1 => $scan };
+        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.