about summary refs log tree commit homepage
path: root/lib/PublicInbox/WatchMaildir.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-29 10:34:21 +0000
committerEric Wong <e@yhbt.net>2020-06-30 03:05:54 +0000
commita49178807cb318c19082c1b970aab942acffd565 (patch)
tree0d8ae87fdf932b8f47e0bd4af8c878ba2e854f8b /lib/PublicInbox/WatchMaildir.pm
parent761baa2a300e426885675a01e4773193ab7101ff (diff)
downloadpublic-inbox-a49178807cb318c19082c1b970aab942acffd565.tar.gz
Maildir scanning still happens in the main process.  Scanning
dozens of Maildirs is still time-consuming and monopolizes the
event loop during WatchMaildir::event_step.  This can cause
cause zombies to accumulate before Sigfd::event_step triggers
DS::reap_pids.
Diffstat (limited to 'lib/PublicInbox/WatchMaildir.pm')
-rw-r--r--lib/PublicInbox/WatchMaildir.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 288f64d1..e3df8515 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -123,9 +123,9 @@ sub new {
 
 sub _done_for_now {
         my ($self) = @_;
-        my $importers = $self->{importers};
-        foreach my $im (values %$importers) {
-                $im->done;
+        local $PublicInbox::DS::in_loop = 0; # waitpid() synchronously
+        for (values %{$self->{importers}}) {
+                $_->done if $_; # $_ may be undef during cleanup
         }
 }
 
@@ -936,6 +936,7 @@ sub fs_scan_step {
         my ($self) = @_;
         return if $self->{quit};
         my $op = shift @{$self->{ops}};
+        local $PublicInbox::DS::in_loop = 0; # waitpid() synchronously
 
         # continue existing scan
         my $max = 10;