diff options
author | Eric Wong <e@80x24.org> | 2023-04-11 11:23:50 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-04-11 17:10:39 +0000 |
commit | 4b1a8231d4bae0931d533b8b8ac8baa56d207d96 (patch) | |
tree | 576891bd6631c350b5f1fd34f1d07737693d37a5 /lib/PublicInbox/Git.pm | |
parent | cbe2548c91859dfb923548ea85d8531b90d53dc3 (diff) | |
download | public-inbox-4b1a8231d4bae0931d533b8b8ac8baa56d207d96.tar.gz |
Retrying requests on alternates changing was causing inflight requests to get lost due to {inflight} getting clobbered by batch_prepare. Unfortunately, reproducing this is difficult without mocking ->alternates_changed. SearchIdx now avoids calling ->batch_prepare directly and relies on more common API functions. Fixes: 65db62eb006f ("git: use --batch-command in git 2.36+ to save processes")
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r-- | lib/PublicInbox/Git.pm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index e35d5277..f153237b 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -229,8 +229,7 @@ sub cat_async_retry ($$) { delete $self->{inflight}; cleanup($self); - $self->{inflight} = $inflight; - batch_prepare($self); + batch_prepare($self, $inflight); my $buf = ''; for (my $i = 0; $i < @$inflight; $i += 3) { $buf .= "$inflight->[$i]\n"; @@ -312,8 +311,8 @@ sub cat_async_wait ($) { } } -sub batch_prepare ($) { - my ($self) = @_; +sub batch_prepare ($$) { + my ($self, $inflight) = @_; check_git_exe(); if ($GIT_VER ge BATCH_CMD_VER) { _bidi_pipe($self, qw(batch-command in out pid err_c)); @@ -321,7 +320,7 @@ sub batch_prepare ($) { } else { _bidi_pipe($self, qw(batch in out pid)); } - $self->{inflight} = []; + $self->{inflight} = $inflight; } sub _cat_file_cb { @@ -581,7 +580,7 @@ sub cat_async_begin { my ($self) = @_; cleanup($self) if $self->alternates_changed; die 'BUG: already in async' if $self->{inflight}; - batch_prepare($self); + batch_prepare($self, []); } sub cat_async ($$$;$) { |