about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchIdxPart.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-23 02:26:45 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-28 18:52:49 +0000
commit9ff1f777cda255d8c9b9224b69241aad7c297db5 (patch)
tree9e6bc225d2e4e2e4d3f84109340f8beadafcba2c /lib/PublicInbox/SearchIdxPart.pm
parentebc3f825c1eb95399c575fff816180a6e4fffeb6 (diff)
downloadpublic-inbox-9ff1f777cda255d8c9b9224b69241aad7c297db5.tar.gz
Leaking these pipes to child processes wasn't harmful, but
made determining relationships and dataflow between processes
more confusing.
Diffstat (limited to 'lib/PublicInbox/SearchIdxPart.pm')
-rw-r--r--lib/PublicInbox/SearchIdxPart.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/SearchIdxPart.pm b/lib/PublicInbox/SearchIdxPart.pm
index 5582d672..64e52636 100644
--- a/lib/PublicInbox/SearchIdxPart.pm
+++ b/lib/PublicInbox/SearchIdxPart.pm
@@ -14,10 +14,7 @@ sub new {
         my $pid = fork;
         defined $pid or die "fork failed: $!\n";
         if ($pid == 0) {
-                foreach my $other (@{$v2writable->{idx_parts}}) {
-                        my $other_w = $other->{w} or next;
-                        close $other_w or die "close other failed: $!\n";
-                }
+                $v2writable->atfork_child;
                 $v2writable = undef;
                 close $w;
 
@@ -74,4 +71,8 @@ sub index_raw {
         $w->flush or die "failed to flush: $!\n";
 }
 
+sub atfork_child {
+        close $_[0]->{w} or die "failed to close write pipe: $!\n";
+}
+
 1;