]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
www_altid: reduce FD pressure in qspawn queues
authorEric Wong <e@80x24.org>
Fri, 27 Oct 2023 22:21:14 +0000 (22:21 +0000)
committerEric Wong <e@80x24.org>
Sat, 28 Oct 2023 09:08:18 +0000 (09:08 +0000)
We can use the built-in stdin redirection functionality of
spawn() instead of creating a pipe that sits idle in the queue
on busy servers.

lib/PublicInbox/WwwAltId.pm

index 4852014289f115b01f1f748d77c074e6c871e8a9..31d9b6075d676c38a6cb740798c75e4cda6f8cdd 100644 (file)
@@ -61,14 +61,9 @@ The administrator needs to install the sqlite3(1) binary
 to support gzipped sqlite3 dumps.</pre>
 EOF
 
-       # setup stdin, POSIX requires writes <= 512 bytes to succeed so
-       # we can close the pipe right away.
-       pipe(my ($r, $w)) or die "pipe: $!";
-       syswrite($w, ".dump\n") == 6 or die "write: $!";
-       close($w) or die "close: $!";
-
        # TODO: use -readonly if available with newer sqlite3(1)
-       my $qsp = PublicInbox::Qspawn->new([$sqlite3, $fn], undef, { 0 => $r });
+       my $qsp = PublicInbox::Qspawn->new([$sqlite3, $fn], undef,
+                                                       { 0 => \".dump\n" });
        $ctx->{altid_pfx} = $altid_pfx;
        $env->{'qspawn.filter'} = PublicInbox::GzipFilter->new;
        $qsp->psgi_yield($env, undef, \&check_output, $ctx);