about summary refs log tree commit homepage
path: root/lib/PublicInbox/Gcf2Client.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-19 09:37:11 +0000
committerEric Wong <e@80x24.org>2020-09-19 21:39:45 +0000
commitdc03cabb5d167618797e9e8a6ec615bda7b0638b (patch)
tree92b55c227d80cca785ac0c2edb0acb0c5c956549 /lib/PublicInbox/Gcf2Client.pm
parent7c0c47e26af17918031d449d24abe40ad452f51a (diff)
downloadpublic-inbox-dc03cabb5d167618797e9e8a6ec615bda7b0638b.tar.gz
Since we only get OIDs from trusted local data sources
(over.sqlite3), we can safely retry within the -gcf2 process
without worry about clients spamming us with requests for
invalid OIDs and triggering reopens.
Diffstat (limited to 'lib/PublicInbox/Gcf2Client.pm')
-rw-r--r--lib/PublicInbox/Gcf2Client.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/PublicInbox/Gcf2Client.pm b/lib/PublicInbox/Gcf2Client.pm
index 71fbb1d1..5120698f 100644
--- a/lib/PublicInbox/Gcf2Client.pm
+++ b/lib/PublicInbox/Gcf2Client.pm
@@ -7,11 +7,13 @@ use PublicInbox::Spawn qw(popen_rd);
 use IO::Handle ();
 
 sub new {
-        my $self = shift->SUPER::new('/nonexistent');
+        my ($rdr) = @_;
+        my $self = bless {}, __PACKAGE__;
         my ($out_r, $out_w);
         pipe($out_r, $out_w) or $self->fail("pipe failed: $!");
-        my $cmd = [ 'public-inbox-gcf2' ];
-        @$self{qw(in pid)} = popen_rd($cmd, undef, { 0 => $out_r });
+        $rdr //= {};
+        $rdr->{0} = $out_r;
+        @$self{qw(in pid)} = popen_rd(['public-inbox-gcf2'], undef, $rdr);
         $self->{inflight} = [];
         $self->{out} = $out_w;
         fcntl($out_w, 1031, 4096) if $^O eq 'linux'; # 1031: F_SETPIPE_SZ
@@ -32,4 +34,7 @@ sub add_git_dir {
                                 $self->fail("write error: $!");
 }
 
+# always false, since -gcf2 retries internally
+sub alternates_changed {}
+
 1;