From: Eric Wong Date: Fri, 27 Oct 2023 22:21:14 +0000 (+0000) Subject: www_altid: reduce FD pressure in qspawn queues X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1469e340205a85d763df556af5e17384394ca4c0;p=thirdparty%2Fpublic-inbox.git www_altid: reduce FD pressure in qspawn queues 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. --- diff --git a/lib/PublicInbox/WwwAltId.pm b/lib/PublicInbox/WwwAltId.pm index 485201428..31d9b6075 100644 --- a/lib/PublicInbox/WwwAltId.pm +++ b/lib/PublicInbox/WwwAltId.pm @@ -61,14 +61,9 @@ The administrator needs to install the sqlite3(1) binary to support gzipped sqlite3 dumps. 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);