about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-27 22:21:14 +0000
committerEric Wong <e@80x24.org>2023-10-28 09:08:18 +0000
commit1469e340205a85d763df556af5e17384394ca4c0 (patch)
tree4e404f21948f967684ac9c4203257bc66313e51b
parent73830410e4336b779c820e90a8604e9e74f38b90 (diff)
downloadpublic-inbox-1469e340205a85d763df556af5e17384394ca4c0.tar.gz
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.
-rw-r--r--lib/PublicInbox/WwwAltId.pm9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/PublicInbox/WwwAltId.pm b/lib/PublicInbox/WwwAltId.pm
index 48520142..31d9b607 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.</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);