about summary refs log tree commit homepage
path: root/lib/PublicInbox/TestCommon.pm
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 /lib/PublicInbox/TestCommon.pm
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 'lib/PublicInbox/TestCommon.pm')
-rw-r--r--lib/PublicInbox/TestCommon.pm1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index b252810f..14ebba10 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -350,6 +350,7 @@ sub start_script {
         }
         defined(my $pid = fork) or die "fork: $!\n";
         if ($pid == 0) {
+                eval { PublicInbox::DS->Reset };
                 # pretend to be systemd (cf. sd_listen_fds(3))
                 # 3 == SD_LISTEN_FDS_START
                 my $fd;